Skip to content

Commit fb8f3c3

Browse files
committed
Update for 1.21.4
1 parent 26b269f commit fb8f3c3

File tree

4 files changed

+127
-20
lines changed

4 files changed

+127
-20
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"model": {
3+
"type": "minecraft:select",
4+
"property": "minecraft:custom_model_data",
5+
"fallback": {
6+
"type": "minecraft:model",
7+
"model": "minecraft:item/iron_nugget"
8+
},
9+
"cases": [
10+
{
11+
"when" : "uno_reverse",
12+
"model" : {
13+
"type": "minecraft:model",
14+
"model": "custom_model_data_guide_assets:item/uno_reverse_model"
15+
}
16+
}
17+
]
18+
}
19+
}

CustomModelDataGuidePack/assets/minecraft/models/item/iron_nugget.json

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"pack": {
3-
"pack_format": 15,
3+
"pack_format": 46,
44
"description": "Custom Model Data Basic Guide"
55
}
66
}

README.md

Lines changed: 107 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,117 @@ To create a custom model data, you first need to take the original model file an
99
<br>Within this folder, create the initial folders `models`, and `textures`, and an `item` folder within both of those.
1010

1111
## Base Model
12-
Open the original model file you're basing off of and add the following code after the textures declaration:
12+
Open the original model file you're basing off of. Original models usually look like this:
1313

1414
```json
15-
,
16-
"overrides" : [
17-
{ "predicate": { "custom_model_data": <data number> }, "model": "<namespace>:<path>" }
18-
]
15+
{
16+
"model": {
17+
"type": "minecraft:model",
18+
"model": "minecraft:item/iron_nugget"
19+
}
20+
}
21+
```
22+
23+
After 1.21.4, custom model data has gotten a lot more flexible, but also requires more things to be added.
24+
25+
So first, change the `"type": "minecraft:model"` to be ```"type": "minecraft:select"```, and remove the next line. It should look like this now:
26+
'`minecraft:select`' is the setup that allows us to use strings to declare the name of the item, if you want to use numbers that's a different setup, which I don't want to teach here because strings are a lot more straightforward.
27+
28+
```json
29+
{
30+
"model": {
31+
"type": "minecraft:select",
32+
}
33+
}
34+
```
35+
36+
Now, add on the next line - ```"property": "minecraft:custom_model_data",```
37+
38+
```json
39+
{
40+
"model": {
41+
"type": "minecraft:select",
42+
"property": "minecraft:custom_model_data",
43+
}
44+
}
45+
```
46+
47+
then you add the 'fallback' texture, so basically the texture this used to point to. In this case, iron nugget. Add `"fallback": {}` and then basically the original contents of the file into the brackets
48+
49+
```json
50+
{
51+
"model": {
52+
"type": "minecraft:select",
53+
"property": "minecraft:custom_model_data",
54+
"fallback": {
55+
"type": "minecraft:model",
56+
"model": "minecraft:item/iron_nugget"
57+
}
58+
}
59+
}
60+
```
61+
62+
Now for the actual declaration of the custom data, we need to add '`"cases":[{}]`' for the different cases that will be shown. i.e. the different models that will be shown.
63+
64+
```json
65+
{
66+
"model": {
67+
"type": "minecraft:select",
68+
"property": "minecraft:custom_model_data",
69+
"fallback": {
70+
"type": "minecraft:model",
71+
"model": "minecraft:item/iron_nugget"
72+
},
73+
"cases": [
74+
{
75+
}
76+
]
77+
}
78+
}
79+
```
80+
81+
Now inside the `{}` we're gonna add `"when": <name>` - this will be the name of the custom data, it'll be what's used in the command.
82+
83+
```json
84+
{
85+
"model": {
86+
"type": "minecraft:select",
87+
"property": "minecraft:custom_model_data",
88+
"fallback": {
89+
"type": "minecraft:model",
90+
"model": "minecraft:item/iron_nugget"
91+
},
92+
"cases": [
93+
{
94+
"when": "uno_reverse"
95+
}
96+
]
97+
}
98+
}
1999
```
20-
<br>For this example, this looks like:
100+
101+
Then we add the model information for where the model is. So it should look like this, after all that.
102+
21103
```json
22-
,
23-
"overrides": [
24-
{ "predicate": { "custom_model_data": 1 }, "model": "custom_model_data_guide_assets:item/uno_reverse_model" }
25-
]
104+
{
105+
"model": {
106+
"type": "minecraft:select",
107+
"property": "minecraft:custom_model_data",
108+
"fallback": {
109+
"type": "minecraft:model",
110+
"model": "minecraft:item/iron_nugget"
111+
},
112+
"cases": [
113+
{
114+
"when" : "uno_reverse",
115+
"model" : {
116+
"type": "minecraft:model",
117+
"model": "custom_model_data_guide_assets:item/uno_reverse_model"
118+
}
119+
}
120+
]
121+
}
122+
}
26123
```
27124

28125
This code tells the game which model file to look for. The model file should be in the `assets/<declared namespace>/models/<declared path>` folder.

0 commit comments

Comments
 (0)