Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.wither.withermod.blocks;
- import com.wither.withermod.Main;
- import net.minecraft.block.Block;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.resources.model.ModelBakery;
- import net.minecraft.client.resources.model.ModelResourceLocation;
- import net.minecraft.item.Item;
- import net.minecraft.util.ResourceLocation;
- public class BlockRender {
- //Sets render method for blocks
- public static void registerBlock(Block block){
- Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(Main.MODID + ":" + block.getUnlocalizedName().substring(5), "inventory"));
- }
- public static void registerBlock(){
- //Ores
- registerBlock(BlockRegistry.Garium_Ore);
- registerBlock(BlockRegistry.Radium_Ore);
- registerBlock(BlockRegistry.LavaGemOre);
- //Crops
- registerBlock(BlockRegistry.cornPlant);
- registerBlock(BlockRegistry.tomatoPlant);
- registerBlock(BlockRegistry.lettucePlant);
- //PaneBlocks
- registerBlock(BlockRegistry.testpane);
- //Blocks
- registerBlock(BlockRegistry.Smooth_slab);
- registerBlock(BlockRegistry.GariumBlock);
- registerBlock(BlockRegistry.RadiumBlock);
- //WoodWall
- reg(BlockRegistry.woodWall, 0, "woodWall_oak");
- reg(BlockRegistry.woodWall, 1, "woodWall_spruce");
- reg(BlockRegistry.woodWall, 2, "woodWall_birch");
- reg(BlockRegistry.woodWall, 3, "woodWall_jungle");
- reg(BlockRegistry.woodWall, 4, "woodWall_acacia");
- reg(BlockRegistry.woodWall, 5, "woodWall_dark_oak");
- //Registers inventory models for woodWall
- final String types[] = {"oak", "spruce", "birch", "jungle", "acacia", "dark_oak"};
- ResourceLocation[] resLoc = new ResourceLocation[6];
- for (int i=0; i < 6; i++)
- resLoc[i] = new ResourceLocation("withermod:woodWall_" + types[i]);
- ModelBakery.registerItemVariants(Item.getItemFromBlock(BlockRegistry.woodWall), resLoc);
- }
- public static void reg(Block block, int meta, String name) {
- Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), meta, new ModelResourceLocation(Main.MODID + ":" + name, "inventory"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement