Jump to content

[1.15.2] Item Model Texture Missing


Andronomos

Recommended Posts

I'm working on a decorative block mod for my personal use. The blocks will be split into categories. To that end I am trying to organize all my block/item models into sub packages. I'm relatively new to Minecraft modding and java in general but after watching a few tutorials I've managed to get everything working as expected except for one thing: I can't get item models to load when organized into sub packages.

 

In the console I get this error:

Quote

[minecraft/ModelBakery]: Unable to load model: 'blockpalette:metal_1#inventory' referenced from: blockpalette:metal_1#inventory: java.io.FileNotFoundException: blockpalette:models/item/metal_1.json

Now obviously it's telling me it can't find find the model.

 

If I take the item model for metal_1 out of :

models/item/metal/

And just place it into

models/item/

It works as expected.

 

Here is my item model for metal_1. Since it's a block I'm simply setting the parent to the block model. As you can see I'm clearly referencing the metal package in my path.

{
  "parent": "blockpalette:block/metal/metal_1"
}

 

Here's my assets structure (ignore bpglass, its a WIP):
2020-04-16_003748.thumb.png.28dbdeca427f35620a3590589ca8a9b3.png

For testing purposes I'm only trying to get metal_1 to load from a sub package. I will move the rest of the files once I figure a solution.

 

I've watched multiple tutorials and read the Forge documentation but can't find any information on item model pathing. Everyone seems to just put them directly in the item package. I know blockstates can't be put into sub packages, is this true for item models as well? That seems a bit weird that block models can be placed in sub packages but item models cant.

 

 Any help would be appreciated.

Edited by Andronomos
Link to comment
Share on other sites

There is no way to change the location of the Item models as they are loaded the same way blockstates are loaded. The only reason the Block models can be moved into subpackages is that they are only referenced via the blockstate files and Item models are referenced statically.

 

Look at net.minecraft.client.renderer.model.ModelBakery#processLoading to see how it loads the models.

Edited by CHEESEBOT314
Added function that finds the files
Link to comment
Share on other sites

26 minutes ago, CHEESEBOT314 said:

There is no way to change the location of the Item models as they are loaded the same way blockstates are loaded.

Thank you, that was the information I was looking for. The only reason I wasn't 100% sure is because I had asked for help elsewhere and was told my JSON was missing the correct pathing but I couldn't for the life of me see anything wrong with it.

Edited by Andronomos
Fixed grammar
Link to comment
Share on other sites

2 hours ago, Andronomos said:

Thank you, that was the information I was looking for. The only reason I wasn't 100% sure is because I had asked for help elsewhere and was told my JSON was missing the correct pathing but I couldn't for the life of me see anything wrong with it.

If you want your Item's to point to a subpackge the easiest way of accomplishing that is to put it in your registry name IE. new Item(...).setRegistryName("modid", "/folder/filename")

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 comment
Share on other sites

24 minutes ago, Animefan8888 said:

If you want your Item's to point to a subpackge the easiest way of accomplishing that is to put it in your registry name IE. new Item(...).setRegistryName("modid", "/folder/filename")

Thanks for the info. I looked into that but haven't been successful yet.

 

I'm getting this error:

Exception caught during firing event: Attempted to set registry name with existing registry name! New: blockpalette:metal_1 Old: blockpalette:/metal/metal_1

 

Here's my ItemList class:

public class ItemList
{
    private static Item.Properties ITEM_PROPERTIES = new Item.Properties().group(Blockpalette.BLOCKPALETTE_TAB);

    public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Reference.MOD_ID);

    //Block Items
    public static final RegistryObject<Item> METAL_1 = ITEMS.register("metal_1", () -> new BlockItem(BlockList.METAL_1.get(), ITEM_PROPERTIES).setRegistryName(Reference.MOD_ID, "/metal/metal_1"));
}

 

I'm assuming I need to call the setRegistryName method before I register the BlockItem but I'm not sure how to do that with a RegistryObject and a DeferredRegister.

Link to comment
Share on other sites

8 minutes ago, Andronomos said:

I'm getting this error:

You're setting the registry name twice.

Here

8 minutes ago, Andronomos said:

ITEMS.register("metal_1"

and here

 

8 minutes ago, Andronomos said:

setRegistryName(Reference.MOD_ID, "/metal/metal_1")

Only do the first one, but change the string.

Edited by Animefan8888
  • Thanks 1

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 comment
Share on other sites

4 minutes ago, Animefan8888 said:

You're setting the registry name twice.

I figured as much. I mean the error was pretty self explanatory, I just didn't know exactly how to fix it.

 

4 minutes ago, Animefan8888 said:

Only do the first one, but change the string.

Thanks so much, I had no idea you could include the path in the name. It's working perfectly now.

 

Here I was about to give up thinking it wasn't possible. Now I just need to figure out Data Generators so I can create my models automatically, lol.

 

Offtopic but is there a way to specify the order of Items in the creative menu? I have all my categories of blocks in a single tab and they are all out of order. I assumed the order was based on the order they were registered in.

 

Link to comment
Share on other sites

2 minutes ago, Andronomos said:

Offtopic but is there a way to specify the order of Items in the creative menu? I have all my categories of blocks in a single tab and they are all out of order. I assumed the order was based on the order they were registered in.

I believe they are, but registries are persistent so if you add a block create a world then add another block which is registered before that block it will still appear second.

I'm not a hundred percent sure on if this is the optimal way to do it, but in your own ItemGroup you can override ItemGroup::fill and after getting all of the items in the tab you can sort them.

  • Thanks 1

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 comment
Share on other sites

2 minutes ago, Animefan8888 said:

I believe they are, but registries are persistent so if you add a block create a world then add another block which is registered before that block it will still appear second.

Yep, that was the problem. I was using the same world when debugging the mod and I had added new blocks and changed their registry names multiple times. Thanks for all your help!

Link to comment
Share on other sites

1 hour ago, Andronomos said:

Yep, that was the problem. I was using the same world when debugging the mod and I had added new blocks and changed their registry names multiple times. Thanks for all your help!

The problem with that then goes for users too. If they update their mod version and it adds new content the ItemGroup will not be sorted in the correct way. It's better to sort the ItemGroup.

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 comment
Share on other sites

39 minutes ago, Animefan8888 said:

The problem with that then goes for users too. If they update their mod version and it adds new content the ItemGroup will not be sorted in the correct way. It's better to sort the ItemGroup.

Thanks for the tip, I will look into how to do that.

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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