I'm trying to render a block with a custom model in my 1.9 mod but it gives me a error at .getItemModelMesher
Code:
public class ModBlocks extends Blocks {
public static Block wooden_table;
public static void init() {
// Create Block
wooden_table = new Block(Material.wood).setUnlocalizedName("wooden_table").setCreativeTab(CreativeTabs.tabMisc);
// Register
GameRegistry.registerBlock(wooden_table, wooden_table.getUnlocalizedName().substring(5));
}
public static void registerRenders() {
registerRender(wooden_table);
}
public static void registerRender(Block block) {
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0,
new ModelResourceLocation(
Main.MODID + ":" + Item.getItemFromBlock(block).getUnlocalizedName().substring(5),
"inventory"));
}
}
Crash report:
---- Minecraft Crash Report ----
Description: Initializing game
java.lang.NullPointerException: Initializing game
at mcrafterzzfurnituremod.blocks.ModBlocks.registerRender(ModBlocks.java:29)
at mcrafterzzfurnituremod.blocks.ModBlocks.registerRenders(ModBlocks.java:25)
Please help I can't find any solution for this problem. If you need more code then just ask.