eowf Posted April 12, 2018 Posted April 12, 2018 I'm updating a mod I wrote a while ago (1.10 I think) and I'm running into FileNotFoundExceptions after changing from the old method to using ModelRegistryEvents. I've also moved the mod to a new dev environment on a different computer, so that may have had an effect (messed up directory structure or something). Here's the full error (which occurs several times): https://pastebin.com/M6GNdrGx This is my directory structure: I have the following json in blockstates: { "variants": { "normal": { "model": "ocmod:sphalerite" } } } in models/block: { "parent": "block/cube_all", "textures": { "all": "ocmod:blocks/sphalerite" } } and in models/item: { "parent":"ocmod:block/sphalerite", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } } These are all in files named sphalerite.json. The blocks, items, and models are registered here @Mod.EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for(Item item : ModItems.ITEMS) { if(item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } for(Block block : ModBlocks.BLOCKS) { if(block instanceof IHasModel) { ((IHasModel)block).registerModels(); } } } } where ITEMS is a list of all the items (including ItemBlocks) and BLOCKS is a list of all the blocks. registerModels calls Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); Where registerItemRenderer is @Override public void registerItemRenderer(Item item, int meta, String id) { ModelResourceLocation rl = new ModelResourceLocation(item.getRegistryName(), id); System.out.println("Registering model: " + rl); ModelLoader.setCustomModelResourceLocation(item, meta, rl); } The print prints "Registering model: ocmod:sphalerite#inventory", which is (as far as I can tell) what is expected. The same problems happen with items. I can host all the code on github if needed, but most of it is unrelated. Quote
Draco18s Posted April 12, 2018 Posted April 12, 2018 This: On 4/12/2018 at 2:40 PM, eowf said: { "variants": { "normal": { "model": "ocmod:sphalerite" } } } Expand variant -> normal does not match this: On 4/12/2018 at 2:40 PM, eowf said: Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory"); Expand variant -> inventory On 4/12/2018 at 2:40 PM, eowf said: "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } Expand Also, you don't need this unless you are intentionally wanting a different set of values (why?) 1 Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
eowf Posted April 13, 2018 Author Posted April 13, 2018 After restarting my computer this morning ALL the textures work, even though I've only applied the change you suggested to one of them (not sure why I didn't try restarting earlier...). Seeing as everything is working, would you still recommend making the change? Why does it work despite them not matching? On 4/12/2018 at 6:44 PM, Draco18s said: Also, you don't need this unless you are intentionally wanting a different set of values (why?) Expand Thanks, I must have seen it in an example somewhere and assumed it didn't default to anything if I left it out. Quote
Draco18s Posted April 13, 2018 Posted April 13, 2018 On 4/13/2018 at 1:43 AM, eowf said: Seeing as everything is working, would you still recommend making the change? Why does it work despite them not matching? Expand IMO if it isn't broke, don't fix it. On 4/13/2018 at 1:43 AM, eowf said: I must have seen it in an example somewhere and assumed it didn't default to anything if I left it out. Expand The values are specified in the parent (or somewhere in the parent hierarchy). 1 Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.