package founderio.taam;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
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.ModMetadata;
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 cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import founderio.taam.blocks.BlockSensor;
import founderio.taam.blocks.BlockSlidingDoor;
import founderio.taam.blocks.TileEntitySensor;
import founderio.taam.blocks.TileEntitySlidingDoor;

@Mod(modid = Taam.MOD_ID, name = Taam.MOD_NAME, version = Taam.MOD_VERSION)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class TaamMain {
	@Instance(Taam.MOD_ID)
	public static TaamMain instance;

	@SidedProxy(clientSide = "founderio.taam.TaamClientProxy", serverSide = "founderio.taam.TaamCommonProxy")
	public static TaamCommonProxy proxy;

	public static CreativeTabs creativeTab;

	public static BlockSensor blockSensor;
	
	public static BlockSlidingDoor blockSlidingDoor;
	
	private Configuration config;
	
	public static int sensor_placement_mode = 1;
	public static int sensor_delay = 30;

	@EventHandler
	public void preInit(FMLPreInitializationEvent event) {
		ModMetadata meta = event.getModMetadata();
		meta.authorList.add(Taam.MOD_AUTHOR1);
		meta.authorList.add(Taam.MOD_AUTHOR2);
		meta.description = Taam.MOD_DESCRIPTION;
		meta.logoFile = Taam.MOD_LOGO_PATH;
		meta.autogenerated = false;
		
		config = new Configuration(event.getSuggestedConfigurationFile());
		config.load();
		
		Property spm = config.get(Configuration.CATEGORY_GENERAL, "sensor_placement_mode", 1, Taam.CFG_COMMENT_SENSOR_PLACEMENT_MODE);
		sensor_placement_mode = spm.getInt();

		if(sensor_placement_mode < 1 || sensor_placement_mode > 2) {
			sensor_placement_mode = 1;
			spm.set(sensor_placement_mode);
		}
		
		Property sd = config.get(Configuration.CATEGORY_GENERAL, "sensor_delay", 30, Taam.CFG_COMMENT_SENSOR_DELAY);
		sensor_delay = sd.getInt();

		if(sensor_delay < 10) {
			sensor_delay = 10;
			sd.set(sensor_delay);
		}
		
		creativeTab = new CreativeTabs(Taam.MOD_ID) {

			@Override
			public ItemStack getIconItemStack() {
				return new ItemStack(blockSensor);
			}
		};

		blockSensor = new BlockSensor(config.getBlock(Taam.BLOCK_SENSOR, 3030).getInt());
		blockSensor.setUnlocalizedName(Taam.BLOCK_SENSOR);
		blockSensor.setCreativeTab(creativeTab);
		
		blockSlidingDoor = new BlockSlidingDoor(config.getBlock(Taam.BLOCK_SLIDINGDOOR, 3031).getInt());
		blockSlidingDoor.setUnlocalizedName(Taam.BLOCK_SLIDINGDOOR);
		blockSlidingDoor.setCreativeTab(creativeTab);
		
		config.save();

		GameRegistry.registerBlock(blockSensor, ItemBlock.class, Taam.BLOCK_SENSOR, Taam.MOD_ID);
		GameRegistry.registerBlock(blockSlidingDoor, ItemBlock.class, Taam.BLOCK_SLIDINGDOOR, Taam.MOD_ID);
		
		GameRegistry.registerTileEntity(TileEntitySensor.class, Taam.TILEENTITY_SENSOR);
		GameRegistry.registerTileEntity(TileEntitySlidingDoor.class, Taam.TILEENTITY_SLIDINGDOOR);
	}

	@EventHandler
	public void init(FMLInitializationEvent event) {
		proxy.registerRenderStuff();
	}

	@EventHandler
	public void postInit(FMLPostInitializationEvent event) {

	}
}

@@ -3102,24 +3102,26 @@
 .MOD_ID);%0A%09%09
+//
 GameRegistry
@@ -3296,16 +3296,18 @@
 SOR);%0A%09%09
+//
 GameRegi

remove Sliding Door Game Registry