Advertisement
Guest User

Untitled

a guest
Aug 12th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public static <BLOCK extends Block> BLOCK registerBlock(BLOCK block, String prefixName, @Nullable String[] suffixName) {
  2. if (suffixName != null) {
  3. GameRegistry.register(block, new ResourceLocation(Reference.MODID, prefixName));
  4. ItemBlock itemBlock = new IMetaItemBlock(block, suffixName);
  5. GameRegistry.register(itemBlock.setRegistryName(block.getRegistryName()));
  6. } else {
  7. GameRegistry.register(block, new ResourceLocation(Reference.MODID, prefixName));
  8. }
  9.  
  10. BLOCKS.add(block);
  11. return block;
  12. }
  13.  
  14. public static void renderBlock(Block block, String prefixName, @Nullable String suffixName, int meta) {
  15. if (suffixName != null) {
  16. ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(Reference.MODID + ":" + prefixName + "_" + suffixName));
  17. } else {
  18. ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement