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.