ItemsModels & CustomModelData
Last updated
Last updated
In the new versions of Minecraft they changed things about the CustomModelData and now they are located in the items folder, this allows adding a component in the item to change its model.
This is a new component added in 1.21.3
, but in 1.21.4
it has been modified, is a way to use an different from those already created or modifying the existing ones, in this case the component references to assets/<namespace>/items/<id>
and would be used as <namespace>:<id>
📦resource_pack.zip
└── 📁assets
└── 📁minecraft
└── 📁items
└── 📁📑some_item.json
In 1.21.3 referenced to assets/<namespace>/models/item/<id>
/give @p diamond[item_model='minecraft:some_item'] 1
📦resource_pack.zip
└── 📁assets
└── 📁minecraft
├── 📁items
│ └── 📑diamond.json
└── 📁models
└── 📁item
└── 📑awesome_item.json
diamond.json
{
"model": {
"type": "minecraft:range_dispatch",
"property": "minecraft:custom_model_data",
"entries": [
{
"threshold": 1382,
"model": {
"model": "minecraft:item/awesome_item",
"type": "minecraft:model"
}
}
],
"scale": 1,
"fallback": {
"type": "minecraft:model",
"model": "minecraft:item/diamond"
}
}
}
/give @p diamond[custom_model_data={floats:[1382]}] 1
{
"model": {
"type": "minecraft:range_dispatch",
"property": "minecraft:custom_model_data",
"entries": [
{
"threshold": 1381,
"model": {
"property": "select",
"type": "minecraft:display_context",
"cases": [
{
"when": [
"gui",
"fixed"
],
"model": {
"type": "minecraft:model",
"model": "minecraft:item/diamond_pickaxe"
}
},
{
"when": [
"thirdperson_lefthand",
"thirdperson_righthand",
"ground",
"none"
],
"model": {
"type": "minecraft:model",
"model": "minecraft:item/diamond_sword"
}
}
]
}
},
{
"threshold": 1382,
"model": {
"model": "minecraft:item/awesome_item",
"type": "minecraft:model"
}
}
],
"scale": 1,
"fallback": {
"type": "minecraft:model",
"model": "minecraft:item/stone_sword"
}
}
}
📦resource_pack.zip
└── 📁assets
├── 📁minecraft
│ └── 📁items
│ └── 📑apple.json
└── 📁elitefantasy
├── 📁models
│ └── 📁custom
│ └── 📁items
│ └── 📁food
│ ├──📑apple_rotated_to_mouth.json
│ ├── 📑apple_eat_1.json
│ ├── 📑apple_eat_2.json
│ ├── 📑apple_eat_3.json
│ ├── 📑apple_eat_4.json
│ ├── 📑apple_eat_5.json
│ └── 📑apple_eat_6.json
└── 📁textures
└── 📁custom
└── 📁items
└── 📁food
├── 🎨apple_eat_1.png
├── 🎨apple_eat_2.png
├── 🎨apple_eat_3.png
├── 🎨apple_eat_4.png
├── 🎨apple_eat_5.png
└── 🎨apple_eat_6.png
apple.json
{
"model": {
"type": "minecraft:select",
"property": "minecraft:display_context",
"cases": [
{
"when": "gui",
"model": {
"type": "minecraft:model",
"model": "minecraft:item/apple"
}
}
],
"fallback": {
"type": "minecraft:condition",
"property": "minecraft:using_item",
"on_false": {
"type": "minecraft:model",
"model": "minecraft:item/apple"
},
"on_true": {
"type": "minecraft:range_dispatch",
"property": "minecraft:use_duration",
"remaining": true,
"scale": 1,
"entries": [
{
"model": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_eat_6"
},
"threshold": 2
},
{
"model": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_eat_5"
},
"threshold": 6
},
{
"model": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_eat_4"
},
"threshold": 10
},
{
"model": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_eat_3"
},
"threshold": 14
},
{
"model": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_eat_2"
},
"threshold": 18
},
{
"model": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_eat_1"
},
"threshold": 22
},
{
"model": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_rotated_to_mouth"
},
"threshold": 26
}
],
"fallback": {
"type": "minecraft:model",
"model": "elitefantasy:custom/items/food/apple_eat_6"
}
}
}
}
}
This would be an example with Christmas
{
"model": {
"type": "minecraft:range_dispatch",
"property": "minecraft:custom_model_data",
"entries": [
{
"threshold": 1382,
"model": {
"type": "minecraft:select",
"pattern": "MM-dd",
"property": "minecraft:local_time",
"cases": [
{
"model": {
"type": "minecraft:model",
"model": "minecraft:item/some_item_christmas"
},
"when": [
"12-24",
"12-25",
"12-26"
]
}
],
"fallback": {
"model": {
"type": "minecraft:model",
"model": "minecraft:item/some_item"
}
}
}
}
],
"scale": 1,
"fallback": {
"type": "minecraft:model",
"model": "minecraft:item/diamond"
}
}
}
custom_model_data Component Tutotial !