#CustomModelData for 1.21.4+ and below
13 messages · Page 1 of 1 (latest)
Please make sure to read #1029373817119838218 as it may answer your question!
Once your question has been resolved, please mark the post as closed by using the </close:1163944441741049897> command.
!faq custom-model-data
Disclaimer: This only works for items (not placed blocks!) and only if you are in Java Edition 1.14 or later!
Example
To give, for example, a stick more models you would have something like this in YourResourcePack/assets/minecraft/models/item and call it stick.json.
stick.json
{
"parent": "item/generated",
"textures": {
"layer0": "item/stick"
},
"overrides": [
{ "predicate": {"custom_model_data": 1}, "model": "item/custom_stick"},
{ "predicate": {"custom_model_data": 2}, "model": "custom/branch"},
{ "predicate": {"custom_model_data": 3}, "model": "block/stone"}
]
}```
That would give the stick 3 additional models it could have.
If you use something else than a stick replace the parts before "overrides" with the exact same information the default model has (The one in models/**item**, not the one in models/block!)
If the default model also has override entries put them before your custom ones in the "overrides" section (don't forget commas between entries).
Type `!faq default-pack` if you don't know how to get the default assets.
# But can I do it without editing .json manually?
Well, good for you Blockbench can actually add overrides to model files.
So copy the default model of the item you wanna add models to into your pack, then load it into Blockbench.
In Blockbench go to Tools > Edit Override Predicates.
There you can add overrides and define the custom_model_data predicates you wanna add.
See the _General knowledge/tips_ section further down if you don't know how to set the model path here.
After you are done, save/export the .json model again.
# Ingame use
To get the item with a custom model use: `/give <player> stick[custom_model_data=X]`
_(`/give <player> stick{CustomModelData:X}` for 1.20.5 and older)_
# General knowledge/tips
- A model path is **always** relative to the "models" folder of your pack.
So `"item/custom_stick"` will load the model in `YourPack/assets/minecraft/models/`**`item`** called **custom_stick**.json;
while `"custom/branch"` will load the model in `YourPack/assets/minecraft/models`**`custom`** called **branch**.json;
and so on.
- The predicates have to be ordered from lowest to highest! This is because Minecraft reads the predicates as "this value or higher" and uses the last entry whose predicate checks are fullfilled.
hi, but i already use the custommodeldata system, it works on clients 1.21.3 and below. I heard 1.21.4 changed how it works, or did rhey just update the syntax?
well, you said "1.21.4 and below" so I thought you meant older than 1.21.4
for the item definition file system you'd create a .json file in
assets/minecraft/items (not to be confused with models/item!) and put something like this inside:
stick.json
{
"model": {
"type": "minecraft:range_dispatch",
"property": "minecraft:custom_model_data",
"entries": [
{
"threshold": 1,
"model": {
"type": "minecraft:model",
"model": "example:item/my_custom_model"
}
}
],
"fallback": {
"type": "minecraft:model",
"model": "minecraft:item/stick"
}
}
}```
You no longer edit any of the default model files, just the item definition file.
The "fallback" section needs to have all the same information that the default item definition file had (similar to how you needed the default override/predicates in the old system for stuff like bows etc.).
ah ok, so if i want to let both 1.21.4+ and below 1.21.4 players to see custom items, i need 2 seperate resource packs?
Well, you can still merge them I guess.
Since the versions will just ignore the old or new way to do things
oh cool, so i can keep the models and textures at where they are now, and just make a new json file in assets/minecraft/items to account for 1.21.4 players?
Should work afaik.
alright thanks! one more thing tho, should i set the pack as the latest version as in mcpack version, or the native version for the server