Jump to content

[SOLVED] [1.10] ModelResourceLocation and model loading errors


Recommended Posts

Posted

Hi,

 

I'm currently updating a mod (Underground Biomes) from 1.8 to 1.10. I'm am having issues with itemblock models. I have several type and each of them have 8 variants that I register like this :

 

protected void registerModel() {
    for (int i = 0; i < NB_VARIANTS; i++) {
        ModelResourceLocation location = new ModelResourceLocation("MODID:name_variantname", "inventory");
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, i, location);
        ModelLoader.setCustomModelResourceLocation(item, i, location);
    }
}

 

Forge keeps trying to register the item without variant (I think) but it shouldn't exist.

 

 

 

[16:18:59] [Client thread/ERROR] [FML]: Exception loading model for variant undergroundbiomes:igneous_stone#inventory for item "undergroundbiomes:igneous_stone", normal location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model undergroundbiomes:item/igneous_stone with loader VanillaLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:317) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

...

Caused by: java.io.FileNotFoundException: undergroundbiomes:models/item/igneous_stone.json

...

[16:18:59] [Client thread/ERROR] [FML]: Exception loading model for variant undergroundbiomes:igneous_stone#inventory for item "undergroundbiomes:igneous_stone", blockstate location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model undergroundbiomes:igneous_stone#inventory with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:325) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

...

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

...

 

 

 

Maybe I don't use ModelResourceLocation correctly. Is there a specific syntax to follow for resource path ? Should I put the variant name like that :

 

new ModelResourceLocation("MODID:name", "variantname");

 

Any ideas ?

Thanks in advance !

Posted

Don't use

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, i, location);

At all.

It should be

new ModelResourceLocation("MODID:name", "inventory");

You do not need to register it with the variant.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

It's not working without that line. The block's items don't have texture now. And Forge is still looking for model like "undergroundbiomes:igneous_stone#inventory".

 

Also I don't understand why this is necessary at all, because all the needed information is in the blockstate json file :

 

 

{

        "variants":{

                "igneous_type=red_granite":{

                        "model":"undergroundbiomes:red_granite"

                },

                "igneous_type=black_granite":{

                        "model":"undergroundbiomes:black_granite"

                },

                "igneous_type=rhyolite":{

                        "model":"undergroundbiomes:rhyolite"

                },

                "igneous_type=andesite":{

                        "model":"undergroundbiomes:andesite"

                },

                "igneous_type=gabbro":{

                        "model":"undergroundbiomes:gabbro"

                },

                "igneous_type=basalt":{

                        "model":"undergroundbiomes:basalt"

                },

                "igneous_type=komatiite":{

                        "model":"undergroundbiomes:komatiite"

                },

                "igneous_type=dacite":{

                        "model":"undergroundbiomes:dacite"

                }

        }

}

 

 

 

Why do we have to specify the location of the itemblock model ?

Posted

Forge is looking for

"variants": {
     'inventory": {}
}

Which is required in a blockstate JSON file. What do you mean "why do we have to specify the location of the itemblock model"?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Ok thanks.

 

I mean forge (or minecraft) could just use the blockstate json file to find the model. It literally says : "for this block and this variants,  use this model". I don't see why we have to say it another time in the code, seems redundant ...

Posted

I have an explanation of the model loading process and how model locations are mapped to model files here.

 

If you want the item form to use the same models as the block form use

new ModelResourceLocation(item.getRegistryName(), "igneous_type=[type]")

as the location for each metadata value, where

[type]

is the value of the

igneous_type

property for that metadata value. This will load the models specified by the blockstates file with the item's registry name (which should be the same blockstates file used for the block models), using the

igneous_type=[type]

variant.

 

You can see how I do this for my coloured rotatable blocks here (

registerBlockItemModelForMeta

is just a wrapper around

ModelLoader.setCustomModelResourceLocation

). The blockstates files can be found here and here.

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.

Posted

Without brackets ? And that's the only method I have to call to set the itemblock model ?

 

Without brackets, yes.

 

ModelLoader.setCustomModelResourceLocation

sets the model for a single

Item

and metadata value. This is the only method you need to call to set the model for an item.

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.

Posted

Still not working ...

 

Here is the blockstate file :

 

 

{

"forge_marker": 1,

"defaults": {

"model": "cube_all",

"uvlock": true

},

"variants": {

"igneous_type": {

"red_granite": {

"textures": {

"all": "undergroundbiomes:blocks/red_granite"

}

},

"black_granite": {

"textures": {

"all": "undergroundbiomes:blocks/black_granite"

}

},

"rhyolite": {

"textures": {

"all": "undergroundbiomes:blocks/rhyolite"

}

},

"andesite": {

"textures": {

"all": "undergroundbiomes:blocks/andesite"

}

},

"gabbro": {

"textures": {

"all": "undergroundbiomes:blocks/gabbro"

}

},

"basalt": {

"textures": {

"all": "undergroundbiomes:blocks/basalt"

}

},

"komatiite": {

"textures": {

"all": "undergroundbiomes:blocks/komatiite"

}

},

"dacite": {

"textures": {

"all": "undergroundbiomes:blocks/dacite"

}

}

}

}

}

 

 

 

And the call :

 

for (int i = 0; i < NB_VARIANTS; i++) {
String variant = block.getVariantProperty().getName() + "=" + block.getVariantName(i);
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName(), variant));
}

 

Posted

Are you definitely calling this in preInit?

 

Post the FML log, it should say what went wrong.

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.

Posted
ModelLoader

methods have always needed to be called in preInit.

ItemModelMesher

methods have always needed to be called in init or later.

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.

  • 4 years later...
Posted
Quote

im trying to add a new sword to minecraft like this

ModelResourceLocation s = new ModelResourceLocation("sword:my_sword","inventory");
            ModelLoader.setCustomModelResourceLocation(sword, 0, s);
Quote

but i always get this problem and texture is purple-black

 

[10:21:03] [Client thread/ERROR] [FML]: Exception loading model for variant sword:my_sword#inventory for item "sword:my_sword", normal location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model sword:item/my_sword with loader VanillaLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:302) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:513) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:378) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_275]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_275]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_275]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_275]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_275]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_275]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_275]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_275]
	at net.minecraftforge.legacydev.Main.start(Main.java:86) [legacydev-0.2.3.1-fatjar.jar:0.2.3.1+4+372be23]
	at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29) [legacydev-0.2.3.1-fatjar.jar:0.2.3.1+4+372be23]
Caused by: java.io.FileNotFoundException: sword:models/item/my_sword.json
	at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:69) ~[SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.access$1400(ModelLoader.java:115) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:861) ~[ModelLoader$VanillaLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
	... 20 more
[10:21:03] [Client thread/ERROR] [FML]: Exception loading model for variant sword:my_sword#inventory for item "sword:my_sword", blockstate location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model sword:my_sword#inventory with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:296) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:151) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:513) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:378) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_275]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_275]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_275]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_275]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_275]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_275]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_275]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_275]
	at net.minecraftforge.legacydev.Main.start(Main.java:86) [legacydev-0.2.3.1-fatjar.jar:0.2.3.1+4+372be23]
	at net.minecraftforge.legacydev.MainClient.main(MainClient.java:29) [legacydev-0.2.3.1-fatjar.jar:0.2.3.1+4+372be23]
Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException
	at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1175) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]

 

 

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Reach Out To Rapid Digital: What sapp Info: +1 41 4 80 7 14 85 Email INFO: rap iddi gita lrecov ery @ exe cs. com Hello, my name is Jayson, and I’m 35 years old from the United Kingdom. My family and I recently endured an incredibly challenging experience that I wouldn’t wish on anyone. We became victims of a cryptocurrency investment fraud scheme that saw us lose a staggering $807,000 in USDT and Bitcoins. The fraudsters had created a convincing facade, and we were lured into investing, only to discover later that the platform was a complete scam. We were left devastated, not just financially, but emotionally, as we had trusted these people and believed in the legitimacy of the investment. After the initial shock wore off, we desperately searched for ways to recover the lost funds. It seemed like an impossible task, and we felt as though there was no hope. That’s when, by sheer luck, we stumbled across a post about Rapid Digital Recovery, a cryptocurrency and funds recovery organization with a proven track record in cybersecurity and fraud recovery. We decided to reach out to them, and from the first interaction, we were impressed with their professionalism and transparency. They explained the recovery process in detail and reassured us that they had the skills and expertise to track down the perpetrators and recover our funds. This gave us a renewed sense of hope, something we hadn’t felt in months. What truly stood out during our experience with Rapid Digital Recovery was their dedication to the recovery process. The team went above and beyond, using sophisticated tracking tools and cyber forensics to gather critical information. Within a matter of weeks, they had successfully located the funds and traced the scam back to the fraudsters responsible. They worked with the authorities to ensure the criminals were held accountable for their actions. To our relief, the team at Rapid Digital Recovery was able to recover every single penny we had lost. The funds were returned in full, and the sense of closure we felt was invaluable. We couldn’t have imagined such a positive outcome in the early stages of our recovery journey, and we are deeply grateful for the work they did. If you ever find yourself in a similar situation, I highly recommend contacting Rapid Digital Recovery. Their expertise, transparency, and dedication to their clients make them the go-to choice for anyone seeking to recover lost cryptocurrency or funds. They truly gave us back our financial future.  
    • This is my first time modding anything, so maybe just skill issue. I'm using Forge 54.0.12 and Temurin 21.0.5+11-LTS I wanted to create a custom keybind and to check whether it works I'd like to send a chat message. I tried using Minecraft.getInstance().player.sendSystemMessage(Component.literal("test")); but IntelliJ couldnt resolve sendSystemMessage(...). Since I saw people using it in earlier versions, I tried the same thing with 1.20.6(- 50.1.0), where it works fine, now I can't figure out if this is intentional and whether there are other options for sending chat messages. On that note, is there more documentation than https://docs.minecraftforge.net/en/1.21.x/? It seems very incomplete compared to something like the Oracle Java docs
    • Hi, i'm having this error and I wanna fix it. we try: -Reload drivers -Eliminate .minecraft -Eliminate Java -Restart launcher -Verify if minecraft is using gpu -Mods  in .minecraft is empty -Install the latest and recomended version of forge idk what i have to do, help me pls. the lastest log is: https://mclo.gs/WAMao8x  
    • Read the FAQ, Rule #2. (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/)  
    • The link to your log does not work, it says it is forbidden, Error, this is a private paste or is pending moderation.
  • Topics

×
×
  • Create New...

Important Information

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