I remember, maybe two years ago now, that there was a new feature in Minecraft that allowed you to change the texture of an item in a resource pack depending on a certain NBT tag that was set for the item in your inventory.
I think this tag was something like "textureId" but I can't remember? It is not the damage value, but a new NBT property.
Does anyone recall what this is, and how to use it?
2 Answers
To summarize the video in David Callanan's answer: You can use the CustomModelData nbt tag. In the .json file of the model you are editing, include one or more override models. Example:
{ "parent": "item/handheld", "textures": { "layer0": "item/carrot_on_a_stick" }, "overrides": [ { "predicate": { "custom_model_data": 1}, "model": "item/carrot_on_a_stick/1" }, { "predicate": { "custom_model_data": 2}, "model": "item/carrot_on_a_stick/2" } ]
}This is an example where the texture of a carrot on a stick is changed. This is replacing the normal text in the carrot_on_a_stick.json . The models being accessed are in a folder next to carrot_on_a_stick.json called carrot_on_a_stick . The models are respectively called 1.json and 2.json.
You'll probably want to have some knowledge of Minecrafts json modeling. For that, I recommend this site. To give yourself one of the custom-textured items in-game, use /give @s minecraft:<item_name>{CustomModelData:<number>}.
After searching for ages, I found out that it's called Custom Model Data.
You can use the CustomModelData nbt tag for items. This is an nbt value. You can change the textures of an item inside your resource pack depending on this value.
Note: CustomModelData tag can not currently be set inside a custom crafting recipe (last checked: 1.14)