Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED] [1.10] ModelResourceLocation and model loading errors


Recommended Posts

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 !

Link to post
Share on other sites

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.

Link to post
Share on other sites

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 ?

Link to post
Share on other sites

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.

Link to post
Share on other sites

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 ...

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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));
}

 

Link to post
Share on other sites

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.

Link to post
Share on other sites
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.

Link to post
Share on other sites
  • 4 years later...
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:?]

 

 

Link to post
Share on other sites
Guest
This topic is now closed to further replies.


  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • What I've been trying to do is I have been attempting to implement an item that can create a transparent blue layer around the entire player. I am using Curios' API for this, as the item is meant to be an equippable accessory. There are also other accessories I have implemented to the mod using the API. I have been able to implement everything that handles this rendering with the accessory item, however I've become stuck after running into a specific issue: when the transparent blue layer is active, it will prevent any accessories specifically on the player's arms from rendering. As far as I can tell, this only happens with the accessories on the player's arms (such as the gloves or even Curios' template knuckles item), as accessories rendering on the player's body for some reason render just fine under the transparent layer. Images for better context: I have been at this for quite awhile but haven't able to figure out what is causing this issue, especially since the inconsistency between rendering for body parts has made me even more confused. It could be a Curios issue, but nothing in its accessory layer code exactly stands out as a cause (if it is indeed Curios' fault though it would at least be good to know what the issue is to pass on to the mod dev). The pendant and glove accessories both render with the same RenderType and render buffer, which I duplicated based on the vanilla armor layer's choices for that, as the vanilla armor layer is also immune to the transparency issue on the arm model part: The relevant code for items and renderers can be found below: Pendants: - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/pendant/PendantItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/PendantModel.java Gloves: - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/gloves/GlovesItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/GlovesModel.java Repulsion Shield (the item creating the transparency layer): - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/common/item/accessories/misc/RepulsionShieldItem.java - https://github.com/Gilded-Games/The-Aether/blob/1.16/src/main/java/com/gildedgames/aether/client/renderer/accessory/model/RepulsionShieldModel.java and, if necessary, Curios' Accessory Layer (code not mine, obviously): - https://github.com/TheIllusiveC4/Curios/blob/1.16.x-forge/src/main/java/top/theillusivec4/curios/client/render/CuriosLayer.java Any help would be appreciated, as I've run out of ideas for what could be causing this issue and how I could fix it. I can provide more information if needed.
    • Ok that's fair. But it's still terrible.
    • Really old Minecraft versions are no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • Ah sorry, you're right. I can refer you to the way Lycanites renders all of their .obj model entities, and best of all it's up to date for 1.16, but it is pretty complicated than just your standard java model. Depending on what you're doing it might not be worth it... https://gitlab.com/Lycanite/LycanitesMobs/-/tree/master/src/main/java/com/lycanitesmobs/client
    • wasn't TEST for item stacks, or tile entities? I know I have to extend an EntityRenderer, but I don't know how to get an obj to render from there
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.