51

Custom Model Data tutorial + example pack - Changing the model of an item

51 emeralds118 replies55,426 views
Geegaz started 10/27/2018 8:12 am history
JustAKat replied 09/14/2020 1:55 am
Hello, I'm Geegaz !

As you may know, the first snapshots of the 1.14 introduced a new format for the JSON item models : "custom_model_data". It's also a new NBT tag you can use on an item with the format {CustomModelData:<data here>}.
Here's a guide/tutorial on how to use it.


This tutorial is not meant for basic ressource pack creation as it touches JSON format.


NBT tag :

The Custom Model Data is a NBT tag that can be added to an item. We will use the iron_ingot as an example.
It's very simple to use as it is not different from any other NBT tag.

Note :
- The data doesn't take commas, if you add them the command won't give an error but will not work.

/give @s minecraft:iron_ingot{CustomModelData:1234567}

JSON format :

To the command above to work, the item needs its JSON format to be defined.
The code below shows how it works.
We use "overrides":{"predicate":{}} to define in which case we'll override the item's model with our custom model or, in this case, the gold_ingot's model.
Here, we wil override it if the item has a CustomModelData of 1234567.

Notes :
- The data is composed of a number with up to 7 digits
*Edit: Since 1.14 the CustomModelData format changed, and using 8 digits doesn't work now*
- The data shouldn't start with 0, or it will give an "error" model
- Doing this only changes the item model. It won't work for blocks models but can change the block's item model (block in the inventory)

{
"parent": "item/generated",
"textures": {
"layer0": "item/iron_ingot"
},

"overrides": [
{"predicate": {"custom_model_data":1234567}, "model": "item/gold_ingot"}
]
}



General notes :
- Here I only changed the iron_ingot to a gold_ingot. But you can also use this format for custom models.
- A tool with durability can be changed, and the damage of the tool will not affect its custom model. It will allow adventure/rpg maps with weapon durability.
- Packs are not compatible ! A tool modified by multiple packs, even with different datas, will only use the first one in the order of the packs applied (the one on top of your active packs in the "ressourcepacks" window)

Hope this tutorial helped you, seeya !

Example pack download :
*Edit: reuploaded the pack to match changes made in 1.14*
- Mediafire -

This pack changes the iron ingot and the carved pumpkin
with the CustomModelData:1234567
Posted by avatar
Geegaz
Level 58 : Grandmaster Engineer
100

118 replies

1
09/14/2020 1:03 amhistory
Level 5 : Apprentice Fisherman
JustAKat
Hi, managed to get the custom model data to work with the below, but the normal item without the custom model data now shows as a flat black-and-purple item (missing textures, which is strange). Any ideas how it can be resolved?


One of the files in assets/minecraft/models/item/coin:

{
"parent": "item/generated",
"textures": {
"layer0": "item/coin-platinum"
}
}



In assets/minecraft/models/item:
{
"parent": "item/generated",
"textures": {
"layer0": "item/sunflower"
},
"overrides": [
{ "predicate": { "custom_model_data": 220}, "model":"item/coin/coin-bronze"},
{ "predicate": { "custom_model_data": 222}, "model":"item/coin/coin-gold"},
{ "predicate": { "custom_model_data": 224}, "model":"item/coin/goin-platinum"},
{ "predicate": { "custom_model_data": 226}, "model":"item/coin/coin-silver"}
]
}
1
09/14/2020 1:55 am
Level 5 : Apprentice Fisherman
JustAKat
Nvm, figured it out from looking at the vanilla data.

{
"parent": "item/generated",
"textures": {
"layer0": "block/sunflower_front"
},
"overrides": [
{ "predicate": { "custom_model_data": 220}, "model":"item/coin/coin-bronze"},
{ "predicate": { "custom_model_data": 222}, "model":"item/coin/coin-gold"},
{ "predicate": { "custom_model_data": 224}, "model":"item/coin/goin-platinum"},
{ "predicate": { "custom_model_data": 226}, "model":"item/coin/coin-silver"}
]
}
1
09/12/2020 10:07 pmhistory
Level 1 : New Miner
3DG_
My blue coin is appearing red, why is that? :(


{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/emerald"
},

"overrides": [
{"predicate": {"custom_model_data": 4750001}, "model": "minecraft:custom/purplecoin"},
{"predicate": {"custom_model_data": 4750002}, "model": "minecraft:custom/bluecoin"},
{"predicate": {"custom_model_data": 4750003}, "model": "minecraft:custom/greencoin"},
{"predicate": {"custom_model_data": 4750004}, "model": "minecraft:custom/yellowcoin"},
{"predicate": {"custom_model_data": 4750005}, "model": "minecraft:custom/redcoin"}
]
}
1
07/26/2020 7:13 pm
Level 1 : New Miner
DowneyD3
Hello, im trying to add a custom sword, but in the game shows a black and purple block,



so, i think that paths is wrong?



Resource pack:

Minecraft > assets > models > custom_sword.json ???





Minecraft > assets > models > item > carrot_on_a_stick.json



{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minecraft:item/carrot_on_a_stick"
},
"overrides": [
{ "predicate": {"custom_model_data": 321123}, "model": "models\custom_sword"}]

}



I dont know what i do :/
1
07/28/2020 12:32 pmhistory
Level 1 : New Explorer
ItsLightningBolt
Hello there! I've been playing around with custom models and all that, and from what I can tell, you need to have any custom models in a subfolder of the models folder like this:
assets/minecraft/models/item/customHope this helped!
1
06/19/2020 3:46 am
Level 3 : Apprentice Explorer
AONK
hi, i was wondering if it's possible to make a music disc with a Custom Model Data tag that can have its own music linked to it, so you can have the base game records as well as custom ones. any help would be appreciated
1
08/29/2020 6:08 pm
Level 1 : New Miner
User3210625F
I think you can do it in few command blocks:

give yourself a disc with CustomModelData tag linked to the texture you want, but also an Array tag or a custom name

I think jukebox is like a container (like a chest), so in its data you should find the item it contains, precisely in its tag RecordItem.

You just have to make an execute command to test if jukebox contains your specific disc. Stopsound for the music the disc will start automatically when u put it in the jukebox and then playsound of the music u want. You can add some custom sounds in your resourcepack.
I didnt test yet, i m pretty sure it will work
3
06/24/2020 3:39 am
Level 58 : Grandmaster Engineer
Geegaz
No, it's not possible. You would need the help of a datapack for that, detecting when a disc with a custom model is used (in minecraft, the music that discs play is hardcoded).

But you can still add custom models for music discs though, even if it's not gonna change the music they play.
1
06/16/2020 8:34 pm
Level 1 : New Miner
broskibble
tysm
1
05/12/2020 12:32 pm
Level 37 : Artisan Nerd
Verdigrix
When I load the game, my crossbow model shows up as a purple and black cube, I've tried multiple things but can't seem to get it to work, here is the code

{
"parent": "item/generated",
"textures": {
"layer0": "item/crossbow_standby"
},
"display": {
"thirdperson_righthand": {
"rotation": [ -90, 0, -60 ],
"translation": [ 2, 0.1, -3 ],
"scale": [ 0.9, 0.9, 0.9 ]
},
"thirdperson_lefthand": {
"rotation": [ -90, 0, 30 ],
"translation": [ 2, 0.1, -3 ],
"scale": [ 0.9, 0.9, 0.9 ]
},
"firstperson_righthand": {
"rotation": [ -90, 0, -55 ],
"translation": [ 1.13, 3.2, 1.13],
"scale": [ 0.68, 0.68, 0.68 ]
},
"firstperson_lefthand": {
"rotation": [ -90, 0, 35 ],
"translation": [ 1.13, 3.2, 1.13],
"scale": [ 0.68, 0.68, 0.68 ]
}
},
"overrides": [
{ "predicate": { "custom_model_data": 1}, "model": "item/50.cal"}
{
"predicate": {
"pulling": 1
},
"model": "item/crossbow_pulling_0"
},
{
"predicate": {
"pulling": 1,
"pull": 0.58
},
"model": "item/crossbow_pulling_1"
},
{
"predicate": {
"pulling": 1,
"pull": 1.0
},
"model": "item/crossbow_pulling_2"
},
{
"predicate": {
"charged": 1
},
"model": "item/crossbow_arrow"
},
{
"predicate": {
"charged": 1,
"firework": 1
},
"model": "item/crossbow_firework"
},
{
"predicate": {
"pulling": 1,
"custom_model_data": 1
},
"model": "item/50.calfire0"
},
{
"predicate": {
"pulling": 1,
"pull": 0.58,
"custom_model_data": 1
},
"model": "item/50.calfire1"
},
{
"predicate": {
"pulling": 1,
"pull": 1.0,
"custom_model_data": 1
},
"model": "item/50.calfire2"
},
{
"predicate": {
"charged": 1,
"custom_model_data": 1
},
"model": "item/50.calfire2"
},
{
"predicate": {
"charged": 1,
"firework": 1,
"custom_model_data": 1
},
"model": "item/50.calfire2"

}
]
}
2
05/12/2020 12:54 pm
Level 58 : Grandmaster Engineer
Geegaz
Did you pass it through a json validator to see if there are any json mistakes ? I use this one (link).
1
05/12/2020 1:29 pmhistory
Level 37 : Artisan Nerd
Verdigrix
Thx

Edit: I ran the code through and fixed it, but it still shows up as a textureless cube in my hand
1
05/13/2020 4:41 am
Level 28 : Expert Dragon
dragonmaster
I'd suggest moving the first predicate to right after the "crossbow_firework" one

Also, assuming you fixed the missing comma after the first predicate (the custom_model_data: 1 one) make sure the problem isn't with the model itself. If a normal crossbow is a purple/black cube then the whole file probably has a syntax error. If it's just the custom_model_data one your custom model is either invalid or not at the path you specified.

The output log is usually your friend (you can enable it in the settings of the Minecraft launcher)
1
05/02/2020 8:41 pm
Level 1 : New Miner
NexionPVP
could you combine this with custom crafting recipes using a data pack

I'm trying to make a craftable weapon for survival that i can craft
3
05/04/2020 6:47 am
Level 58 : Grandmaster Engineer
Geegaz
Be careful though, you can't craft items with nbt. That's a big limitations datapacks have to get around. So in short, no you can't combine it with regular crafting. You can add custom recipes but you'll have to use workarounds to add nbt to these items.
1
05/04/2020 2:25 pm
Level 1 : New Miner
NexionPVP
yea I ended up using a method of testing to see if the player has the items in their inventory and if they did then it asks if they want to craft it if they click yes then it gives them an advancement that gives them the item and clears there inventory of those certain items and then takes away the advancement so they can get it again
1
04/27/2020 4:17 pmhistory
Level 10 : Journeyman Modder
TheSova
Hi, i iried to use "item/generated" value for "parent" tag on the spawn egg and basic egg now displays missing texture. Have you any information about the "parent" tag becsuse i tried and failed to find information
1
04/30/2020 2:11 am
Level 58 : Grandmaster Engineer
Geegaz
to use "item/generated", you souldn't have any model data, just textures. They should be named layer0 (and layer1 in the case of some items like leather armor, eggs and potions). So in the end, a model using "item/generated" should look like this:
{
"parent": "item/generated",
"textures": {
"layer0": "path/to/texture",
"layer1": "path/to/other/texture"
}
}

Note that usually, in the few models that need 2 layers, layer1 displays on top of layer0.
1
04/22/2020 5:43 amhistory
Level 1 : New Miner
TimOD
Hi, idk if this is the right place but... could you change the texture of an item to a 3d texture if it has different nbt data? Would use .json and blockbench. I would like to change different dyed firework stars as diffrent custom items... but how?

Edit:
the problem is that after crafting there is no hint on what the nbt data exacly is or it saxs that it has changed but not into what.
1
04/26/2020 12:26 pm
Level 58 : Grandmaster Engineer
Geegaz
It's not possible, you would have to use Custom Model Data for that.
1
04/17/2020 9:48 am
Level 1 : New Miner
NoaGaming68
Can custom model data be applied to blocks?
1
04/17/2020 1:08 pm
Level 58 : Grandmaster Engineer
Geegaz
No, CMD is only for items. There are some ways to create custom block models but they're mostly workarounds or replace vanilla models.
1
04/19/2020 2:17 am
Level 1 : New Miner
PixelUHC
can i use dispensers, droppers, furnaces ... to make me a new custom block model data?
1
03/08/2020 1:10 am
Level 1 : New Miner
NewZee
umm do you know any texture packs that use custom model data? so I can just customize it?
1
03/09/2020 2:57 am
Level 58 : Grandmaster Engineer
Geegaz
You can check my datapacks GGUNZ and GGDK, they use custom model data for every item.
1
03/08/2020 12:47 am
Level 1 : New Miner
NewZee
What's your name on dropbox?
1
03/08/2020 12:39 am
Level 1 : New Miner
NewZee
Ummm, why there's no output log?
I'm using Tlauncher
1
02/26/2020 5:07 am
Level 1 : New Miner
NewZee
Title of Expandable Spoiler

is it on a datapack or texture pack?
1
02/26/2020 5:05 am
Level 1 : New Miner
NewZee
Hey can somebody help me my custom model is not working properly its shows the purple and black block
1
02/26/2020 5:33 am
Level 58 : Grandmaster Engineer
Geegaz
Hello !
If the base item is fine, but the custom model shows as a black and purple cube, then your custom model itself has a problem. If the base item shows the error cube you might've made a mistake when adding your overrides.
Put them through a json validator and see if there are any errors.
1
02/27/2020 6:13 am
Level 1 : New Miner
NewZee
I had put in this

{
"parent": "item/generated",
"textures": {
"layer0": "item/apple"
}
,

"overrides": [
{"predicate": {"custom_model_data":1}, "model": "item/custom/green1"}
]
}

when ever I add in another file to path or add another non item to the texture itself it shows the purple and black block
1
02/27/2020 6:15 am
Level 1 : New Miner
NewZee
why its still doesn't work?
):
1
02/27/2020 6:15 am
Level 1 : New Miner
NewZee
HEy can you check my resource pack?

How can I Send the File?
1
03/01/2020 9:09 am
Level 58 : Grandmaster Engineer
Geegaz
You can use a free online drive like Google Drive, Media fire or Dropbox to send me your pack (and it would be better to do it in private messages).

If you don't know what's the problem, you may need to enable the Minecraft output log to check. To do that, go in the launcher settings, and check "Open output log when game starts". But from what I see, all I can say is that maybe your custom model "green" is not in the right folder or doesn't exist.

One last thing, I'd recommend to keep your custop models outside the "models/item/" folder, 'cause I'm pretty sure only vanilla item models go there.
1
02/25/2020 11:36 am
Level 1 : New Miner
Targys
Hello!
I think there is something I misunderstood: I tried your example pack, but it doesn't work for me. The iron ingot that I give myself with the /give command and the CMD tag do not take the texture of the gold ingot. The datapack is enable, no problem, and I trie with another datapack and another item, but nothing change. What did I miss?
1
02/25/2020 12:00 pm
Level 58 : Grandmaster Engineer
Geegaz
Hi !
You're talking about datapacks... this is a resourcepack, not the same thing. You need to put it in the "resourcepacks" folder in "appdata/.minecraft".
I hope that's the issue ? If you followed the tutorial, there shouldn't be any other problem.
1
02/25/2020 3:35 pm
Level 1 : New Miner
Targys
Thank you for your answer!
Yes I completely misunderstood the use of this tag. I was hoping he can be use in a datapack for server-side use. Knowing nothing about resource packs (I am more in datapacks), I know however someone who may be interested!
1
02/13/2020 3:07 pm
Level 1 : New Miner
Mabbity_Duke
any idea why this isn't working for me?


{
"parent": "item/generated",
"textures": {
"layer0": "item/stone_sword"
},

"overrides": [
{"predicate": {"custom_model_data":1234567}, "model": "item/stick"}
]
}
2
02/16/2020 5:27 pm
Level 58 : Grandmaster Engineer
Geegaz
Check the name of your model file, then check if it's located in "minecraft/models/item/".

Does the model look like a big black and purple cube ingame ? If yes, your model itself has a problem.

Does the model have theright shape but the texture is black and purple ingame ? If yes, your texture reference has a problem.



If you're not sure, in your launcher settings check the box "Open output log when game starts" and try to identify the error in the logs (should be a warning or an error, so no need to keep regular debug informations).

Hope that helped !
1
02/08/2020 1:01 pm
Level 30 : Artisan Network
Foony the Foxacoon
Hey!

Is it possible to make items (more specifically carrot-on-a-stick) have a 3D model in hand, but have a 2D icon in inventory?
1
02/10/2020 2:39 pm
Level 58 : Grandmaster Engineer
Geegaz
Sadly no, as far as I know.

I think the only item that has this ability is the trident.
2
02/06/2020 9:34 am
Level 13 : Journeyman Miner
THEBrotherHolmes
What I'd like to know is, how can you tell a loot table to drop something different when you use a custom model data tool on it? (Both blocks and mobs)

Example:
Rare loot that only drops if you use emerald tools and weapons.
1
02/06/2020 3:08 pm
Level 58 : Grandmaster Engineer
Geegaz
Hum...
I assume you're already familiar with loot tables, so it will be easier (else this guide is really good but outdated, so use it along with this one).
First, your table must be a "mine" type. Then, use the condition "minecraft:match_tool", and in the predicates add an "nbt" field. Following the syntax in the two guides, you should get this:
{
"condition": "minecraft:match_tool",
"predicate": {
    "nbt": "{CustomModelData: <your CMD>}"
}
}

where you need to replace <your CMD> by the custom model data you want.

Hope that helped, have a nice day !
1
02/10/2020 4:44 am
Level 13 : Journeyman Miner
THEBrotherHolmes
Thanks for the help! What about using the CMD for an advancement icon? I tried this...
"icon": {
"item": "minecraft:diamond_pickaxe",
"nbt": "{CustomModelData: 3860366}"
}
It shows my emerald pickaxe, which is the 1st CMD in the model file, but it doesn't show the one that the number belongs to sadly.
1
02/10/2020 4:54 am
Level 13 : Journeyman Miner
THEBrotherHolmes
Nevermind, I'm so embarrassed, I didn't F3+T to reload my resource pack after I added the other textures and models.
1
02/01/2020 2:00 pm
Level 1 : New Miner
AzurePhe0nix
Hey Geegaz, I want to ask you how to change the item model for blocks, because I can't seem to find a guide that teaches you how to change the item models of carved pumpkins with the custom model data. Thanks in advance.
1
02/02/2020 3:23 am
Level 58 : Grandmaster Engineer
Geegaz
Hello, it's really simple, actually !

Think of it as this : when in your inventory, blocks are just items. They actually have an item model and a block model. What I'd recommend is to copy the item model of the carved pumpkin from the default assets (read this for more precisions on how to find them) and apply the tutorial above to this item model.
Hope that helped, have a nice day !
1
01/16/2020 5:38 am
Level 1 : New Network
SpoonsTU
Yo Geegaz, I was wondering if maybe you had any idea why my model/textures are shown in-game as invisible. I have looked everywhere and asked around and no one seems to know what the problem is.
Thanks!
1
01/16/2020 10:27 am
Level 58 : Grandmaster Engineer
Geegaz
That's very strange ! But with the little info you posted it's difficult to know.
Maybe you could post here your code (.json of the base item model and your custom model) along with pictures of what you see (or don't) ingame. It may be that your model is misplaced so you don't see it in 1rst person, or that you have an invisible texture on it.
Please give me more info so we can figure this out ^^ !
1
01/16/2020 3:22 pmhistory
Level 1 : New Network
SpoonsTU
File Tree:

assets

  minecraft

    models

      custom

        diamond_dagger

      diamond_sword
    textures


      custom

        blade.png

        bladeedge.png

        guard.png
        handle.png
        hilt.png


        hiltbottomtop.png





keyboard_arrow_downdiamond_sword.json


keyboard_arrow_downdiamond_dagger.json (my model)




What I see ingame is that the item is there in my inventory, but it is invisible or translucent I guess is the correct wording.
https://imgur.com/a/4IBUjZG

I also made the model with BlockBench idk if that is important
Planet Minecraft Logo

Website

© 2010 - 2020
www.planetminecraft.com

Welcome