whizvox Posted January 18, 2016 Share Posted January 18, 2016 Trying to get back into modding, and the new rendering system doesn't seem to complicated, except I can't get it to work. The item renders as a black and purple cube in my inventory. Here's the console output: http://pastebin.com/BjWcKWkG And here's the code: Inside main mod class @Mod.EventHandler public void onPreInitialization(FMLPreInitializationEvent event) { FMLLog.info("Currently initializing %s version %s,", Reference.MOD_ID, Reference.VERSION); ConfigurationHandler.init(event.getSuggestedConfigurationFile()); ModItems.init(); proxy.onPreInitialization(event); } @Mod.EventHandler public void onInitialization(FMLInitializationEvent event) { proxy.onInitialization(event); } @Mod.EventHandler public void onPostInitializing(FMLPostInitializationEvent event) { proxy.onPostInitializationEvent(event); FMLLog.info("Finished initializing."); } Inside the ClientProxy class @Override public void onPreInitialization(FMLPreInitializationEvent event) { // register key bindings } @Override public void onInitialization(FMLInitializationEvent event) { ResourceLocationHelper.registerItemRenderer(ModItems.denseMatterVessel); } Inside ResourceLocationHelper public static void registerItemRenderer(ItemQSBase item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( item, 0, new ModelResourceLocation( Reference.UNIVERSAL_PREFIX + Reference.MOD_ID_LOWERCASE + item.getUnwrappedUnlocalizedName(), "inventory" ) ); } Inside the ModItems class public static ItemDenseMatterVessel denseMatterVessel; public static void init() { GameRegistry.registerItem(denseMatterVessel = new ItemDenseMatterVessel(), "denseMatterVessel"); denseMatterVessel.setCreativeTab(CreativeTabQuantumStorage.INSTANCE); } Inside the ItemDenseMatterVessel class public class ItemDenseMatterVessel extends Item { public ItemDenseMatterVessel() { // UNIVERSAL_PREFIX is "quantumstorage:" setUnlocalizedName(Reference.UNIVERSAL_PREFIX + unlocalizedNameBase); } } Quote Link to comment Share on other sites More sharing options...
Choonster Posted January 18, 2016 Share Posted January 18, 2016 Minecraft only loads one model per item by default, the name of this model is the item's registry name (the name passed to GameRegistry.registerItem or Item#setRegistryName ). If you want to load a different model or multiple models, you need to call ModelBakery.registerItemVariants with the locations of those models. I would highly recommend using Forge's ModelLoader.setCustomModelResourceLocation and ModelLoader.setCustomMeshDefinition methods in preInit instead of the vanilla ItemModelMesher#register overloads in init. ModelLoader.setCustomModelResourceLocation will call ModelBakery.registerItemVariants with the model location for you. I would also recommend setting the registry names of your items with Item#setRegistryName and registering them with GameRegistry.registerItem(Item) . You can get an item's registry name in the "modid:name" format from Item#getRegistryName . This also applies to blocks. I have a whole bunch of model registration code for my item models here. I use Forge's blockstates format and Java 8 features quite a lot in my mod. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future. Link to comment Share on other sites More sharing options...
whizvox Posted January 18, 2016 Author Share Posted January 18, 2016 I MISNAMED THE JSON FILE DAMMIT Thanks for the suggestion Choonster. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.