Advertisement
Guest User

ModBlocks Class

a guest
Apr 10th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. package com.gedy.GodCraft;
  2.  
  3.  
  4.  
  5. import com.sun.prism.Material;
  6.  
  7. import net.minecraft.block.Block;
  8. import net.minecraft.client.Minecraft;
  9. import net.minecraft.client.renderer.ItemModelMesher;
  10. import net.minecraft.client.resources.model.ModelResourceLocation;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.util.ResourceLocation;
  13. import net.minecraftforge.fml.common.registry.GameRegistry;
  14.  
  15. public class ModBlocks
  16. {
  17. public static Block sec;
  18.  
  19. public static void preInit() { //To be called from the main mod class to register the blocks
  20. sec = new BlockSEC();
  21. }
  22.  
  23. public static void init() { // To be called from main mod class to register block JSON
  24.  
  25. registerModel(sec);
  26.  
  27. }
  28.  
  29. private static void registerModel(Block block) //Helper method to block model mesher
  30. {
  31. ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
  32.  
  33. mesher.register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(new ResourceLocation(GodCraft.MODID.toLowerCase(), block.getUnlocalizedName().substring(5)), "inventory"));
  34.  
  35. GameRegistry.registerBlock(new BlockSEC(Material.rock,"sec"), "sec");
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement