package net.mcft.copy.betterstorage.addon;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

import net.mcft.copy.betterstorage.addon.thaumcraft.ThaumcraftAddon;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public abstract class Addon {
	
	private static final List<Addon> addons = new ArrayList<Addon>();
	private static final Addon thaumcraft = new ThaumcraftAddon();
	
	public static void initialize() {
		ListIterator<Addon> iter = addons.listIterator();
		while (iter.hasNext()) {
			Addon addon = iter.next();
			if (!Loader.isModLoaded(addon.modName))
				iter.remove();
		}
	}
	
	public static void setupConfigsAll() {
		for (Addon addon : addons) addon.setupConfig();
	}
	public static void initializeTilesAll() {
		for (Addon addon : addons) addon.initializeBlocks();
	}
	public static void initializeItemsAll() {
		for (Addon addon : addons) addon.initializeItems();
	}
	public static void addRecipesAll() {
		for (Addon addon : addons) addon.addRecipes();
	}
	public static void registerEntitesAll() {
		for (Addon addon : addons) addon.registerEntities();
	}
	public static void registerTileEntitesAll() {
		for (Addon addon : addons) addon.registerTileEntities();
	}
	@SideOnly(Side.CLIENT)
	public static void registerRenderersAll() {
		for (Addon addon : addons) addon.registerRenderers();
	}
	public static void postInitializeAll() {
		for (Addon addon : addons) addon.postInitialize();
	}
	
	
	public final String modName;
	
	public Addon(String modName) {
		this.modName = modName;
		addons.add(this);
	}
	
	public void setupConfig() {  }
	
	public void initializeItems() {  }
	
	public void initializeBlocks() {  }
	
	public void addRecipes() {  }
	
	public void registerEntities() {  }
	
	public void registerTileEntities() {  }
	
	@SideOnly(Side.CLIENT)
	public void registerRenderers() {  }
	
	public void postInitialize() {  }
	
}

@@ -91,39 +91,8 @@
 ist;
-%0Aimport java.util.ListIterator;
 %0A%0Aim
@@ -376,225 +376,50 @@
 );%0A%09
-private static final Addon thaumcraft = new ThaumcraftAddon();%0A%09%0A%09public static void initialize() %7B%0A%09%09ListIterator%3CAddon%3E iter = addons.listIterator();%0A%09%09while (iter.hasNext()) %7B%0A%09%09%09Addon addon = iter.next();%0A%09
+%0A%09public static void initialize() %7B%0A
 %09%09if (
-!
 Load
@@ -437,46 +437,45 @@
 ded(
-addon.modName))%0A%09%09%09%09iter.remove();%0A%09%09%7D
+%22Thaumcraft%22)) new ThaumcraftAddon();
 %0A%09%7D%0A

Fix Thaumcraft API being required