package com.bernard.torch; import com.bernard.torch.gui.TorchGuiHandler; import com.bernard.torch.init.CoalStickAndTorchesRegister; import com.bernard.torch.init.CommonProxy; import com.bernard.torch.init.TorchBlocks; import com.bernard.torch.init.TorchItems; 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 cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import java.io.PrintStream; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @Mod(modid="torch_mod", name="Torch mod", version="beta") public class TorchMod { public static final String MODID = "torch_mod"; @Mod.Instance("torch_mod") public static TorchMod MOD_INSTANCE; @SidedProxy(clientSide="com.bernard.torch.init.ClientProxy", serverSide="com.bernard.torch.init.CommonProxy") public static CommonProxy proxy; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { CoalStickAndTorchesRegister c = new CoalStickAndTorchesRegister(); CoalStickAndTorchesRegister.registerCoal(Items.coal, 4); CoalStickAndTorchesRegister.registerCoal(Blocks.coal_block, 36); CoalStickAndTorchesRegister.registerCoal(Blocks.coal_ore, 8); CoalStickAndTorchesRegister.registerStick(Items.stick, 4); CoalStickAndTorchesRegister.registerStick(Blocks.planks, 8); CoalStickAndTorchesRegister.registerStick(Blocks.log, 32); CoalStickAndTorchesRegister.registerStick(Blocks.log2, 32); CoalStickAndTorchesRegister.registerStick(Blocks.deadbush, 3); CoalStickAndTorchesRegister.registerTorch(Blocks.torch, 1); CoalStickAndTorchesRegister.registerTorch(Blocks.glowstone, 4); TorchItems.init(); TorchBlocks.init(); Item i = Items.coal; System.out.println(CoalStickAndTorchesRegister.isStick(i)); System.out.println(CoalStickAndTorchesRegister.isCoal(i)); System.out.println(CoalStickAndTorchesRegister.isTorch(i)); } @Mod.EventHandler public void init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(MOD_INSTANCE, new TorchGuiHandler()); } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 0), new Object[] { " MM", "M M", "TM ", Character.valueOf('M'), Items.string, Character.valueOf('T'), Blocks.torch }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 1), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), Items.coal, Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 0) }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 2), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), Items.iron_ingot, Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 1) }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 3), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), Items.quartz, Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 2) }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 4), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), Items.gold_ingot, Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 3) }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 5), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), Items.redstone, Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 4) }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 6), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), new ItemStack(Items.dye, 1, 4), Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 5) }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 7), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), Items.diamond, Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 6) }); GameRegistry.addShapedRecipe(new ItemStack(TorchItems.torchAmulet, 1, 8), new Object[] { " MM", "MIM", "TM ", Character.valueOf('M'), Items.emerald, Character.valueOf('T'), Blocks.torch, Character.valueOf('I'), new ItemStack(TorchItems.torchAmulet, 1, 7) }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 0), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), Blocks.furnace, Character.valueOf('M'), Blocks.cobblestone }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 1), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 0), Character.valueOf('M'), Blocks.coal_block }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 2), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 1), Character.valueOf('M'), Blocks.iron_block }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 3), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 2), Character.valueOf('M'), Blocks.quartz_block }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 4), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 3), Character.valueOf('M'), Blocks.gold_block }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 5), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 4), Character.valueOf('M'), Blocks.redstone_block }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 6), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 5), Character.valueOf('M'), Blocks.lapis_block }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 7), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 6), Character.valueOf('M'), Blocks.diamond_block }); GameRegistry.addShapedRecipe(new ItemStack(TorchBlocks.torchRecharger, 1, 8), new Object[] { "T T", "CFC", "CMC", Character.valueOf('T'), Blocks.torch, Character.valueOf('C'), Blocks.cobblestone, Character.valueOf('F'), new ItemStack(TorchBlocks.torchRecharger, 1, 7), Character.valueOf('M'), Blocks.emerald_block }); } }