Topic category: User side tutorials
Hi all
After 3 day of research I discovered you cant make a procedure that change Custom Model Data of an item! I found only one way to bypass that. Make custom code.I wrote a code if player have enchanted_book in inventory its gonna get custom model data. Remember you cant set Custom Model Data on already existing item. You need to replace that item. Just copy content and add Custom Model Data component then set new item in slot. After you write a code you need to make models. First go to your workspace folder. Go to src -> main - > resources -> asset and here create a folder called minecraft then in minecraft create 2 folders. models, textures,in textures make folder item and put here your textures here in models create folder item and in item folder create a .json file( its gonna be a head of our structure,main one )
Json file should look like this - Main json(name should be your item_name.json. Example enchanted_book.json)
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/your_item"
},
"overrides": [
{
"predicate": { "custom_model_data": 1 },
"model": "modID:item/ItemExample"
},
{
"predicate": { "custom_model_data": 2 },
"model": "modID:item/ItemExample"
}
]
}
After creating main .json file go make item example!(Item example should be in folder where main json file is.Json name should be the same as in main.json.Those jsons are externals. That is important. Inside these files there are path to textures!)
{
"parent": "item/your_item",
"textures": {
"layer0": "item/youre_item_texture_name"
}
}
After that launch minecraft!.
If you have "unknown texture" there is a solution for that!
1.Check if custom model data is in order(main.json)
2.Check if all name are correctly.
3.Check if all textures names are correctly
After repairing its should be okay.
If texture deosnt change you need to repair your code that adds custom model data!
Remember
- You cant add custom model data on already existing item. You need to replace it with item that have Custom model data( Just use Set item block ) Remember to set custom model data in order! 1,2,3,4,5 If your custom model data is in random order its wont gonna work
Tips - To check if item have Custom Data model component use command /data get Dev SelectedItem
- if item have spaces in name dont put here spaces use underscore example: totem_of_undying , minecart_with_tnt
- External json need to match with item that is in main json
Its all. If you have any problem comment it under post(I might help you w that)
So this is used to have animations that change the model of an item? Or just to have custom models for vanilla items?