Posted March 7, 201510 yr I am trying to figure out the 1.8 item rendering thing but get a null pointer exception with this line: Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(References.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); Mod class: @Mod(name = References.NAME, modid = References.MODID, version = References.VERSION) public class ExampleMod { @SidedProxy(clientSide = "com.example.examplemod.ClientProxy", serverSide = "com.example.examplemod.CommonProxy") public static CommonProxy proxy; @Instance(References.MODID) public static ExampleMod modInstance; @EventHandler public void preInit(FMLPreInitializationEvent e) { TutorialItems.init(); TutorialItems.register(); } @EventHandler public void init(FMLPreInitializationEvent e) { proxy.render(); } @EventHandler public void postInit(FMLPreInitializationEvent e) { } } Items class: public class TutorialItems { public static Item test_item; public static void init() { test_item = new Item().setUnlocalizedName("test_item"); } public static void register() { GameRegistry.registerItem(test_item, test_item.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(test_item); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(References.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } Client proxy: public class ClientProxy extends CommonProxy { @Override public void render() { TutorialItems.registerRenders(); } }
March 7, 201510 yr Author That may have had an effect... Now just having this issue when loading the game: [18:39:02] [Client thread/ERROR] [FML]: Model definition for location example:test_item#inventory not found The Json file should be under src/main/resources/assets/modid/models/item and the texture under src/main/resources/assets/modid/textures/items, right?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.