// Path: src/main/java/com/dta/extracarts/block/FakeBlockRegistry.java
// public class FakeBlockRegistry {
// 	static private ArrayList<FakeSubBlock> fakeSubBlockArrayList = new ArrayList<FakeSubBlock>();
// 	static private ArrayList<FakeBlock> fakeBlockArrayList = new ArrayList<FakeBlock>();
// 
// 	static public void registerBlocks() {
// 		int numberOfBlocks = (int) Math.ceil(getFakeSubBlockArrayList().size() / 16.0);
// 
// 		for(int x = 0; x < numberOfBlocks; x++) {
// 			FakeBlock fakeBlock = new FakeBlock(x);
// 			getFakeBlockArrayList().add(fakeBlock);
// 			GameRegistry.registerBlock(fakeBlock, fakeBlock.getUnlocalizedName());
// 		}
// 
// 		for(int x = 0; x < getFakeSubBlockArrayList().size(); x++) {
// 			int blockNumber = (int) Math.ceil(x / 16.0);
// 			int metaNumber = x % 16;
// 			getFakeSubBlockArrayList().get(x).setBlockNumber(blockNumber);
// 			getFakeSubBlockArrayList().get(x).setMetaNumber(metaNumber);
// 			FakeSubBlock[] fakeBlockArray = getFakeBlockArrayList().get(blockNumber).getFakeSubBlockArray();
// 			fakeBlockArray[metaNumber] = getFakeSubBlockArrayList().get(x);
// 			getFakeBlockArrayList().get(blockNumber).setFakeSubBlockArray(fakeBlockArray);
// 		}
// 	}
// 
// 	static public void registerSubBlock(FakeSubBlock fakeSubBlock) {
// 		getFakeSubBlockArrayList().add(fakeSubBlock);
// 	}
// 
// 	public static ArrayList<FakeSubBlock> getFakeSubBlockArrayList() {
// 		return fakeSubBlockArrayList;
// 	}
// 
// 	public static ArrayList<FakeBlock> getFakeBlockArrayList() {
// 		return fakeBlockArrayList;
// 	}
// 
// 	public static FakeSubBlock getFakeBlockByName(String name) {
// 		for(FakeSubBlock fakeSubBlock: getFakeSubBlockArrayList()) {
// 			if(fakeSubBlock.getBlockName().equals(name))
// 				return fakeSubBlock;
// 		}
// 		return null;
// 	}
// }
// 
// Path: src/main/java/com/dta/extracarts/client/GuiHandler.java
// public class GuiHandler implements IGuiHandler {
// 	
// 	public GuiHandler() {
// 		NetworkRegistry.INSTANCE.registerGuiHandler(ExtraCarts.instance, this);
// 	}
// 
// 	@Override
// 	public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
// 		Entity entity = world.getEntityByID(x);
// 		if(entity instanceof OpenableGUI) {
// 			return ((OpenableGUI) entity).getServerGuiElement(ID, player, world, x, y, z);
// 		}
// 		return null;
// 	}
// 
// 	@Override
// 	public Object getClientGuiElement(int ID, EntityPlayer player, World world,	int x, int y, int z) {
// 		Entity entity = world.getEntityByID(x);
// 		if(entity instanceof OpenableGUI) {
// 			return ((OpenableGUI) entity).getClientGuiElement(ID, player, world, x, y, z);
// 		}
// 		return null;
// 	}
// 
// }
// 
// Path: src/main/java/com/dta/extracarts/config/ConfigHandler.java
// public class ConfigHandler {
// 	public static File configFile = null;
// 
// 	public static void init(){
// 		Configuration config = new Configuration(configFile);
// 		config.load();
//         for(Module module: ModInfo.getModules()) {
// 			module.setIsActive(config.get("Modules", module.getModuleName() + " Enabled", true).getBoolean(true));
//         }
// 		config.save();
// 	}
// 
// 	public static void setConfigFile(File suggestedConfigurationFile) {
// 		configFile = suggestedConfigurationFile;
// 	}
// }
// 
// Path: src/main/java/com/dta/extracarts/proxy/CommonProxy.java
// public class CommonProxy {
// 	public void init(FMLPreInitializationEvent event) {
// 
// 	}
// }
// 
// Path: src/main/java/com/dta/extracarts/utils/LogUtils.java
// public class LogUtils {
// 	public static void log(Level level, String message) {
// 		LogManager.getLogger(ModInfo.NAME).log(level, message);
// 	}
// 
// 	public static void debug(String message) {
// 		log(Level.DEBUG, message);
// 	}
// }


import com.dta.extracarts.block.FakeBlockRegistry;
import com.dta.extracarts.client.GuiHandler;
import com.dta.extracarts.config.ConfigHandler;
import com.dta.extracarts.proxy.CommonProxy;
import com.dta.extracarts.utils.LogUtils;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.Level;
package com.dta.extracarts;


@Mod(modid = ModInfo.MODID, name = ModInfo.NAME, version = ModInfo.VERSION)
public class ExtraCarts {
	@Instance(ModInfo.MODID)
	public static ExtraCarts instance;

	@SidedProxy(clientSide = "com.dta.extracarts.proxy.ClientProxy", serverSide = "com.dta.extracarts.proxy.CommonProxy")
	public static CommonProxy proxy;

	@EventHandler
	public void init(FMLPreInitializationEvent event) {
		ConfigHandler.setConfigFile(event.getSuggestedConfigurationFile());
        ConfigHandler.init();

		for(Module module : ModInfo.getModules()) {
			if(!module.areRequirementsMet() && module.getIsActive()) {
				module.setIsActive(false);
				LogUtils.log(Level.ERROR, "Requirements are not met for " + module.getModuleName() + ". Deactivating");
			}
			if(module.getIsActive()) {
				LogUtils.log(Level.INFO, "Loading " + module.getModuleName() + " module");
			}
		}

        for(Module module : ModInfo.getModules()) {
			if(module.getIsActive())
				module.init(event);
		}
		FakeBlockRegistry.registerBlocks();
		proxy.init(event);
	}
	
	@EventHandler
	public void load(FMLInitializationEvent event) {
// Path: src/main/java/com/dta/extracarts/block/FakeBlockRegistry.java
// public class FakeBlockRegistry {
// 	static private ArrayList<FakeSubBlock> fakeSubBlockArrayList = new ArrayList<FakeSubBlock>();
// 	static private ArrayList<FakeBlock> fakeBlockArrayList = new ArrayList<FakeBlock>();
// 
// 	static public void registerBlocks() {
// 		int numberOfBlocks = (int) Math.ceil(getFakeSubBlockArrayList().size() / 16.0);
// 
// 		for(int x = 0; x < numberOfBlocks; x++) {
// 			FakeBlock fakeBlock = new FakeBlock(x);
// 			getFakeBlockArrayList().add(fakeBlock);
// 			GameRegistry.registerBlock(fakeBlock, fakeBlock.getUnlocalizedName());
// 		}
// 
// 		for(int x = 0; x < getFakeSubBlockArrayList().size(); x++) {
// 			int blockNumber = (int) Math.ceil(x / 16.0);
// 			int metaNumber = x % 16;
// 			getFakeSubBlockArrayList().get(x).setBlockNumber(blockNumber);
// 			getFakeSubBlockArrayList().get(x).setMetaNumber(metaNumber);
// 			FakeSubBlock[] fakeBlockArray = getFakeBlockArrayList().get(blockNumber).getFakeSubBlockArray();
// 			fakeBlockArray[metaNumber] = getFakeSubBlockArrayList().get(x);
// 			getFakeBlockArrayList().get(blockNumber).setFakeSubBlockArray(fakeBlockArray);
// 		}
// 	}
// 
// 	static public void registerSubBlock(FakeSubBlock fakeSubBlock) {
// 		getFakeSubBlockArrayList().add(fakeSubBlock);
// 	}
// 
// 	public static ArrayList<FakeSubBlock> getFakeSubBlockArrayList() {
// 		return fakeSubBlockArrayList;
// 	}
// 
// 	public static ArrayList<FakeBlock> getFakeBlockArrayList() {
// 		return fakeBlockArrayList;
// 	}
// 
// 	public static FakeSubBlock getFakeBlockByName(String name) {
// 		for(FakeSubBlock fakeSubBlock: getFakeSubBlockArrayList()) {
// 			if(fakeSubBlock.getBlockName().equals(name))
// 				return fakeSubBlock;
// 		}
// 		return null;
// 	}
// }
// 
// Path: src/main/java/com/dta/extracarts/client/GuiHandler.java
// public class GuiHandler implements IGuiHandler {
// 	
// 	public GuiHandler() {
// 		NetworkRegistry.INSTANCE.registerGuiHandler(ExtraCarts.instance, this);
// 	}
// 
// 	@Override
// 	public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
// 		Entity entity = world.getEntityByID(x);
// 		if(entity instanceof OpenableGUI) {
// 			return ((OpenableGUI) entity).getServerGuiElement(ID, player, world, x, y, z);
// 		}
// 		return null;
// 	}
// 
// 	@Override
// 	public Object getClientGuiElement(int ID, EntityPlayer player, World world,	int x, int y, int z) {
// 		Entity entity = world.getEntityByID(x);
// 		if(entity instanceof OpenableGUI) {
// 			return ((OpenableGUI) entity).getClientGuiElement(ID, player, world, x, y, z);
// 		}
// 		return null;
// 	}
// 
// }
// 
// Path: src/main/java/com/dta/extracarts/config/ConfigHandler.java
// public class ConfigHandler {
// 	public static File configFile = null;
// 
// 	public static void init(){
// 		Configuration config = new Configuration(configFile);
// 		config.load();
//         for(Module module: ModInfo.getModules()) {
// 			module.setIsActive(config.get("Modules", module.getModuleName() + " Enabled", true).getBoolean(true));
//         }
// 		config.save();
// 	}
// 
// 	public static void setConfigFile(File suggestedConfigurationFile) {
// 		configFile = suggestedConfigurationFile;
// 	}
// }
// 
// Path: src/main/java/com/dta/extracarts/proxy/CommonProxy.java
// public class CommonProxy {
// 	public void init(FMLPreInitializationEvent event) {
// 
// 	}
// }
// 
// Path: src/main/java/com/dta/extracarts/utils/LogUtils.java
// public class LogUtils {
// 	public static void log(Level level, String message) {
// 		LogManager.getLogger(ModInfo.NAME).log(level, message);
// 	}
// 
// 	public static void debug(String message) {
// 		log(Level.DEBUG, message);
// 	}
// }


// Path: src/main/java/com/dta/extracarts/ExtraCarts.java
import com.dta.extracarts.block.FakeBlockRegistry;
import com.dta.extracarts.client.GuiHandler;
import com.dta.extracarts.config.ConfigHandler;
import com.dta.extracarts.proxy.CommonProxy;
import com.dta.extracarts.utils.LogUtils;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.Level;

package com.dta.extracarts;


@Mod(modid = ModInfo.MODID, name = ModInfo.NAME, version = ModInfo.VERSION)
public class ExtraCarts {
	@Instance(ModInfo.MODID)
	public static ExtraCarts instance;

	@SidedProxy(clientSide = "com.dta.extracarts.proxy.ClientProxy", serverSide = "com.dta.extracarts.proxy.CommonProxy")
	public static CommonProxy proxy;

	@EventHandler
	public void init(FMLPreInitializationEvent event) {
		ConfigHandler.setConfigFile(event.getSuggestedConfigurationFile());
        ConfigHandler.init();

		for(Module module : ModInfo.getModules()) {
			if(!module.areRequirementsMet() && module.getIsActive()) {
				module.setIsActive(false);
				LogUtils.log(Level.ERROR, "Requirements are not met for " + module.getModuleName() + ". Deactivating");
			}
			if(module.getIsActive()) {
				LogUtils.log(Level.INFO, "Loading " + module.getModuleName() + " module");
			}
		}

        for(Module module : ModInfo.getModules()) {
			if(module.getIsActive())
				module.init(event);
		}
		FakeBlockRegistry.registerBlocks();
		proxy.init(event);
	}
	
	@EventHandler
	public void load(FMLInitializationEvent event) {
	    new GuiHandler();