Jump to content

Jimmeh

Members
  • Posts

    131
  • Joined

  • Last visited

Everything posted by Jimmeh

  1. Hey guys, so I'm learning how to create custom items, and for some reason, the JSON file can't be found even though I'm 99% sure my file structure is correct. Here's the code where I register the models (from what I understand, this event is ran client-side once the ModelLoader is ready for models): @SubscribeEvent public static void registerModels(ModelRegistryEvent event){ for(Item item: ItemHandler.INSTANCE.itemList){ ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Test.MODID + ":" + item.getRegistryName(), "inventory")); } } And here's a screenshot of my folder structure: https://gyazo.com/5833a05b1e69ec11647a312ea24dd5f6 As you can see, I have 'assets.test.models.item.ItemTrainingStaff.json'. The registry name for the item is "ItemTrainingStaff", however, it continues to spit out the error: "Caused by: java.io.FileNotFoundException: test:models/item/ItemTrainingStaff.json". If you have any idea as to why this could be happening, I'm all ears! Thanks!
  2. No. We specifically added the 'RegistryEvent.Register<Type>' events to clean up this confusion. Create and register your items/blocks in THIS EVENT ONLY. The ModelRegistryEvent is for registering Models as they are not standard FML controlled registries. I know you're the head honcho, but if you have a moment: I created the listener and all is dandy so far. But all I have to do is event.getRegistry.register(item) ? Or would I also need to still getItemModelMesher().register() (or alternatively, as told to me previously in this thread) ModelLoader.setCustomModelResourceLocation(item, someIntForSomething, new ModelResourceLocation(...) As always, any guidance is greatly appreciated!
  3. Okay, thanks guys. The events seemed like a cleaner way to do it, I just wasn't sure what to use since when you register an item, aren't you also registering its model (getItemModelMesher or ModelResourceLocation)? That's also part of what threw me off. But I appreciate all the help so far!
  4. Okay, thanks! I'll give this a shot. Piggy backing off of this, off the top of your head, would you know what int value to use as metaData in ModelLoader.setCustomModelResourceLocation?
  5. Oh okay. So don't use the ModelRegistryEvent? Just throw that code into PreInit?
  6. Hey there! I'm currently looking through registry events, and I'm confused at which I should be using for what reason. Let's say I've made a custom item. Currently, I have the registration happening in my ClientProxy's PostInit(), being called on the FMLPostInitializationEvent. I was told that I should be doing the registering in a register event. I've come across two different events that seem applicable to me, so I'd like to know the best practice. The first is the RegistryEvent.Register<Item>. The second is ModelRegistryEvent. I'm not too sure which to use. If I had to guess, I'd say just go with the latter, but I want to make sure I follow the best practice. And in that spirit, here's the code I'm using to register my items (in case you'd like to offer some advice here as well. I have those 2 other return statements commented out because my texture isn't being loaded and I'm trying to figure out why). Any help is greatly appreciated Code: http://pastebin.com/jSQkPTjM
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.