Guest User

Untitled

a guest
Nov 9th, 2014
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.72 KB | None | 0 0
  1. package tutorial.generic;
  2.  
  3. import net.minecraft.block.Block;
  4. import net.minecraft.block.BlockContainer;
  5. import net.minecraft.block.material.Material;
  6. import net.minecraft.client.gui.Gui;
  7. import net.minecraft.client.particle.EntityFX;
  8. import net.minecraft.creativetab.CreativeTabs;
  9. import net.minecraft.init.Blocks;
  10. import net.minecraft.init.Items;
  11. import net.minecraft.inventory.Container;
  12. import net.minecraft.item.Item;
  13. import net.minecraft.item.ItemBlock;
  14. import net.minecraft.item.ItemStack;
  15. import net.minecraft.item.crafting.FurnaceRecipes;
  16. import net.minecraft.tileentity.TileEntity;
  17. import cpw.mods.fml.common.Mod;
  18. import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2
  19. //import cpw.mods.fml.common.Mod.PreInit; // used in 1.5.2
  20. //import cpw.mods.fml.common.Mod.Init; // used in 1.5.2
  21. //import cpw.mods.fml.common.Mod.PostInit; // used in 1.5.2
  22. import cpw.mods.fml.common.Mod.Instance;
  23. import cpw.mods.fml.common.SidedProxy;
  24. import cpw.mods.fml.common.event.FMLInitializationEvent;
  25. import cpw.mods.fml.common.event.FMLPostInitializationEvent;
  26. import cpw.mods.fml.common.event.FMLPreInitializationEvent;
  27. //import cpw.mods.fml.common.network.NetworkMod; // not used in 1.7
  28. import cpw.mods.fml.common.registry.GameRegistry;
  29. import cpw.mods.fml.common.network.NetworkRegistry;
  30.  
  31. @Mod(modid = "Generic", name = "Generic", version = "0.0.0")
  32. // @NetworkMod(clientSideRequired=true) // not used in 1.7
  33. public class Generic {
  34.  
  35. public static Item genericItem;
  36. public static Item genericIngot;
  37.  
  38. public static Block genericDirt;
  39. public static Block genericOre;
  40.  
  41. public static Block enderSapling;
  42. public static Block enderPlanks;
  43. public static Block enderTreeLog;
  44. public static Block enderTreeLeaves;
  45. public static Block enderCrop;
  46. public static Block enderFurnaceLit;
  47. public static Block enderFurnaceUnlit;
  48. public static TileEntity tileEntityEnderFurnace;
  49. public static Block enderCraftingTable;
  50.  
  51. public static Item enderSeeds;
  52.  
  53. // The instance of your mod that Forge uses.
  54. @Instance(value = "Generic")
  55. public static Generic instance;
  56.  
  57. // Says where the client and server 'proxy' code is loaded.
  58. @SidedProxy(clientSide = "tutorial.generic.client.ClientProxy", serverSide = "tutorial.generic.CommonProxy")
  59. public static CommonProxy proxy;
  60.  
  61. @EventHandler
  62. // used in 1.6.2
  63. // @PreInit // used in 1.5.2
  64. public void preInit(FMLPreInitializationEvent event) {
  65. // .setBlockTextureName("generic:genericBlock");
  66. genericItem = new GenericItem()
  67. .setTextureName("genericmod:genericItem");
  68. genericIngot = new GenericItem().setMaxStackSize(64)
  69. .setUnlocalizedName("genericIngot")
  70. .setTextureName("genericmod:genericIngot");
  71.  
  72. genericDirt = new GenericBlock(Material.ground)
  73. .setBlockName("genericDirt").setHardness(.2F)
  74. .setStepSound(Block.soundTypeGravel)
  75. .setBlockTextureName("genericmod:genericBlock");
  76. genericOre = new GenericOre(Material.rock)
  77. .setBlockTextureName("genericmod:genericOre");
  78.  
  79. enderSapling = new EnderSapling().setBlockName("enderSapling")
  80. .setHardness(0F).setBlockTextureName("endermod:enderSapling");
  81. enderPlanks = new EnderPlanks().setBlockName("enderPlanks")
  82. .setHardness(2F).setBlockTextureName("endermod:enderPlanks");
  83.  
  84. enderCrop = new EnderCrop().setBlockName("enderCrop")
  85. .setBlockTextureName("endermod:enderCrop");
  86. enderSeeds = new EnderSeeds(Generic.enderCrop, Blocks.farmland)
  87. .setTextureName("endermod:enderSeeds").setUnlocalizedName(
  88. "enderSeeds");
  89. enderFurnaceLit = new EnderFurnace(true).setHardness(2F).setBlockName(
  90. "enderFurnaceLit");
  91. enderFurnaceUnlit = new EnderFurnace(false).setHardness(2F)
  92. .setBlockName("enderFurnaceUnlit")
  93. .setCreativeTab(CreativeTabs.tabMisc);
  94. tileEntityEnderFurnace = new TileEntityEnderFurnace();
  95. enderCraftingTable = new EnderCraftingTable().setHardness(2F)
  96. .setBlockName("enderCraftingTable")
  97. .setBlockTextureName("endermod:crafting_table");
  98.  
  99. // The second parameter is an unique registry identifier (not the
  100. // displayed name)
  101. // Please don't use item1.getUnlocalizedName(), or you will make Lex sad
  102.  
  103. // GameRegistry.registerBlock(enderSapling,"enderSapling");
  104. // GameRegistry.registerBlock(enderTreeLog,"enderTreeLog");
  105. // GameRegistry.registerBlock(enderTreeLeaves,"enderTreeLeaves");
  106.  
  107. GameRegistry.registerItem(genericItem, "genericItem");
  108. GameRegistry.registerItem(genericIngot, "genericIngot");
  109.  
  110. GameRegistry.registerBlock(genericDirt, "genericDirt");
  111. GameRegistry.registerBlock(genericOre, "genericOre");
  112.  
  113. GameRegistry.registerItem(enderSeeds, "enderSeeds");
  114. GameRegistry.registerBlock(enderCrop, "enderCrop");
  115. GameRegistry.registerBlock(enderPlanks, "enderPlanks");
  116.  
  117. GameRegistry.registerBlock(enderFurnaceUnlit, "enderFurnaceUnlit");
  118. GameRegistry.registerBlock(enderFurnaceLit, "enderFurnaceLit");
  119. GameRegistry.registerTileEntity(TileEntityEnderFurnace.class,
  120. "tileEntityEnderFurnace");
  121. // GameRegistry.registerBlock(enderCraftingTable, "enderCraftingTable");
  122.  
  123. // Recipes
  124. // GameRegistry.addRecipe(new ItemStack(Items.diamond, 64), new
  125. // ItemStack(Blocks.dirt));
  126.  
  127. /*
  128. * ItemStack dirtStack = new ItemStack(Blocks.dirt); ItemStack
  129. * gravelStack = new ItemStack(Blocks.gravel); ItemStack cobbleStack =
  130. * new ItemStack(Blocks.cobblestone);
  131. * GameRegistry.addShapelessRecipe(new ItemStack(Items.diamond, 64),
  132. * dirtStack, dirtStack, dirtStack, dirtStack, dirtStack, dirtStack, new
  133. * ItemStack(Blocks.sand), gravelStack, cobbleStack);
  134. */
  135. ItemStack brickstack = new ItemStack(Blocks.nether_brick);
  136. ItemStack netherstack = new ItemStack(Blocks.netherrack);
  137. // GameRegistry.addShapedRecipe(new
  138. // ItemStack(Blocks.nether_brick),"xxx","xxx","xxx", 'x', brickstack);
  139. GameRegistry.addShapedRecipe(brickstack, new Object[] { "x x", "x x",
  140. "x x", 'x', brickstack });
  141.  
  142. // Note not only Block -> Blocks but stoneBrick -> stonebrick
  143. GameRegistry.addSmelting(Blocks.stone,
  144. new ItemStack(Blocks.stonebrick), 0.1f);
  145.  
  146. // For smelting items with metadata
  147. /*
  148. * ItemStack woolStackBlack = new ItemStack(Blocks.wool); ItemStack
  149. * woolStackWhite = new ItemStack(Blocks.wool);
  150. * woolStackBlack.setItemDamage(15); woolStackWhite.setItemDamage(1);
  151. * GameRegistry.addSmelting(woolStackBlack, woolStackWhite, 0.1f);
  152. */
  153.  
  154. }
  155.  
  156. @EventHandler
  157. // used in 1.6.2
  158. // @Init // used in 1.5.2
  159. public void load(FMLInitializationEvent event) {
  160. proxy.registerRenderers();
  161. ;
  162. NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); // new
  163. // GuiHandler());
  164.  
  165. }
  166.  
  167. @EventHandler
  168. // used in 1.6.2
  169. // @PostInit // used in 1.5.2
  170. public void postInit(FMLPostInitializationEvent event) {
  171. // Stub Method
  172.  
  173. }
  174. }
Advertisement
Add Comment
Please, Sign In to add comment