How do I get my custom model to accept multiple textures at once?
1 Answer
If you have a custom model that you have created, you may want to reuse that model but with a different texture. Luckily, there is a way to do that without creating a near identical model for every texture.
For this, I will use a spell slate pack I am creating as an example. After finishing your model, you should end up with a JSON file that looks similar to this:
With my texture spell_blank
being this:
I want my new slate texture to replace an arrow with the CustomModelData of 4230000
, so I open the arrow.json
default file and modify it to look like this:
If we look in game, we can see it works perfectly:
But, I now want to make a 2nd slate which looks like this:
As I said before, I could make a 2nd model file with the new texture instead of the blank texture, however if I then want to change what the model for all the slates, I'd have to edit every texture's model file. I don't know about you, but I certainly didn't want to do that. So instead I modified my model file to look like this:
Can you see what I did? Just in case you didn't, I removed the "textures"
element. By itself, this model cannot be used in game now, unless you want a purple and black look.
To get the texture's back, I created this spell_blank.json
file:
The "parent"
element points towards where I placed the model (spell_base
) within the model/item
folder. This is where I moved the "textures"
element to. (It's important to note, that within the arrow.json
file, you must change the "model":
file to point to the new spell_blank.json
instead of the base model.)
If you reload the resource pack, you should see that the model once again has it's texture. For this, it should look like nothing has changed.
First, I make a new .json file called spell_elec
, which looks like this:
I then need to modify the arrow to point to two different models, as seen here:
The green highlighted text is what points to the 2nd model, while the final "predicate"
element means that any other number points back at the original arrow.
As you can see, the game has mapped both the spell_elec
and spell_blank
onto the spell_base
model, but if I decide to change what the base model looks like, I need only change the root (Or parent) file.
When I was making this resource pack I couldn't find any help online, so when I worked it out by myself I wanted to write the answer that I couldn't find. If you were looking for the same answers I was, I hope this helps. If you know more than me and notice there's ways to make this easier, please let me know!