Advertisement
Guest User

Untitled

a guest
Aug 17th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. package tutorial.generic;
  2.  
  3. import net.minecraft.client.Minecraft;
  4. import net.minecraft.client.renderer.entity.RenderItem;
  5. import net.minecraft.client.resources.model.ModelResourceLocation;
  6.  
  7. import net.minecraft.item.Item;
  8. import net.minecraft.block.Block;
  9. import net.minecraft.block.material.Material;
  10.  
  11. import net.minecraft.init.Items;
  12. import net.minecraft.init.Blocks;
  13. import net.minecraft.item.ItemStack;
  14. import net.minecraft.creativetab.CreativeTabs;
  15.  
  16. import net.minecraftforge.fml.common.registry.GameRegistry;
  17. import net.minecraftforge.client.model.ModelLoader;
  18.  
  19. import net.minecraftforge.fml.common.Mod;
  20. import net.minecraftforge.fml.common.Mod.EventHandler;
  21. import net.minecraftforge.fml.common.Mod.Instance;
  22.  
  23. import net.minecraftforge.fml.common.event.FMLInitializationEvent;
  24. import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
  25. import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
  26.  
  27. @Mod(modid=Generic.MODID, name=Generic.MODNAME, version=Generic.MODVER)
  28. public class Generic {
  29. // Set the ID of the mod (should be lowercase).
  30. public static final String MODID = "generic";
  31. // Set the "name" of the mod.
  32. public static final String MODNAME = "Generic Mod";
  33. // Set the version of the mod.
  34. public static final String MODVER = "1.0.0";
  35.  
  36. @Instance(Generic.MODID)
  37. public static Generic instance;
  38.  
  39. public final static Block soilClay = new GenericBlock(Material.ground)
  40. .setHardness(0.7f).setStepSound(Block.soundTypeGravel)
  41. .setUnlocalizedName("soil_clay").setCreativeTab(CreativeTabs.tabBlock);
  42.  
  43. @EventHandler
  44. public void preInit(FMLPreInitializationEvent event) {
  45. // register blocks
  46. GameRegistry.registerBlock(soilClay, "soil_clay");
  47.  
  48. // render blocks when they're in inventory and dropped
  49. RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
  50. renderItem.getItemModelMesher().register(
  51. Item.getItemFromBlock(soilClay),
  52. 0, new ModelResourceLocation("generic:soil_clay", "inventory")
  53. );
  54. }
  55.  
  56. @EventHandler
  57. public void load(FMLInitializationEvent event) {
  58. }
  59.  
  60. @EventHandler
  61. public void postInit(FMLPostInitializationEvent event) {
  62.  
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement