Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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:

dirStructure.PNG.8cc743be566b882749a58de12d96b8f0.PNG

 

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.

This:

4 hours ago, eowf said:

{ "variants": { "normal": { "model": "ocmod:sphalerite" } } }

variant -> normal

does not match this:

4 hours ago, eowf said:

Main.proxy.registerItemRenderer(Item.getItemFromBlock(this), 0, "inventory");

variant -> inventory

4 hours ago, eowf said:

"display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } }

Also, you don't need this unless you are intentionally wanting a different set of values (why?)

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.

  • Author

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?

 

Just now, Draco18s said:

Also, you don't need this unless you are intentionally wanting a different set of values (why?)

Thanks, I must have seen it in an example somewhere and assumed it didn't default to anything if I left it out.

14 minutes ago, eowf said:

Seeing as everything is working, would you still recommend making the change? Why does it work despite them not matching?

IMO if it isn't broke, don't fix it.

14 minutes ago, eowf said:

I must have seen it in an example somewhere and assumed it didn't default to anything if I left it out.

The values are specified in the parent (or somewhere in the parent hierarchy).

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.