80

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

Geegaz's Avatar Geegaz10/27/18 8:12 am history
80 emeralds 213.3k 148
11/3/2021 11:18 am
IMK011's Avatar IMK011
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 Geegaz's Avatar
Geegaz
Level 67 : High Grandmaster Engineer
203

Create an account or sign in to comment.

148

4
10/31/2018 8:47 am
Level 52 : Grandmaster Taco
Knux
Knux's Avatar
i'm really surprised that hardly anyone has addressed this impactful moment for minecraft creators
2
01/02/2019 2:06 pmhistory
Level 60 : High Grandmaster Robot
Nitrox Nova
Nitrox Nova's Avatar
Just stumbled across this after reading the wiki documentation, the download is greatly appreciated!
4
05/27/2019 1:15 pm
Level 1 : New Miner
Kirse88
Kirse88's Avatar
Can I ask how to make custom texture for bow? I've been struggling whole evening and I still don't have it right.
1
05/29/2019 1:43 pm
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
That's a good, and rather difficult question !

To add custom model to a bow (I'm saying model, but a model can be just a texture change), you need to change the "predicate:{}" part of the bow.json file to use custom_model_data.
See this thread on Minecraft forum for better explainations, just replace "damage:" by "custom_model_data:" in "predicate:{}".

Hope that helped, have a good day ^^
2
05/31/2019 10:22 amhistory
Level 56 : Grandmaster Miner
samo_lego
samo_lego's Avatar
Hi! I've been messing with that too, and ... I can't get it to work. Custom models work for me, but only if I delete the "normal" / "vanilla" bow lines. If I put them back, the stationary bows are fine, however, once you start to charge them, they default to the vanilla bow. As mentioned, if I remove lines for vanilla bow, all of them work, just the vanilla one doesn't. Any ideas?

EDIT: Well, I was silly, I put custom lines BEFORE the vanilla ones. If anyone finds it useful :-)
1
06/05/2019 2:02 amhistory
Level 1 : New Explorer
teflon819
teflon819's Avatar
Hi, I'm trying to mess with custom bows too, could you please show me the .JSON files, I can't get it to work, at first I thought it was a comma, then a predicate, then this and then that. I've been working on this for like 3 day by now.

For the bow.json file, I've written this:
{
"parent": "item/generated",
"textures": {
"layer0": "item/bow"
},
"display": {
"thirdperson_righthand": {
"rotation": [ -80, 260, -40 ],
"translation": [ -1, -2, 2.5 ],
"scale": [ 0.9, 0.9, 0.9 ]
},
"thirdperson_lefthand": {
"rotation": [ -80, -280, 40 ],
"translation": [ -1, -2, 2.5 ],
"scale": [ 0.9, 0.9, 0.9 ]
},
"firstperson_righthand": {
"rotation": [ 0, -90, 25 ],
"translation": [ 1.13, 3.2, 1.13],
"scale": [ 0.68, 0.68, 0.68 ]
},
"firstperson_lefthand": {
"rotation": [ 0, 90, -25 ],
"translation": [ 1.13, 3.2, 1.13],
"scale": [ 0.68, 0.68, 0.68 ]
}
},
"overrides":
[
{"predicate": {"pulling": 1}, "model": "item/bow_pulling_0"},
{"predicate": {"pulling": 1, "pull": 0.65}, "model": "item/bow_pulling_1"},
{"predicate": {"pulling": 1, "pull": 0.9}, "model": "item/bow_pulling_2"},

{"predicate": {"custom_model_data":819}, "model": "item/bow/1"},
{"predicate": {"custom_model_data":819, "pulling": 1}, "model": "item/bow/2"},
{"predicate": {"custom_model_data":819, "pulling": 1, "pull": 0.65},"model": "item/bow/3"},
{"predicate": {"custom_model_data":819, "pulling": 1, "pull": 0.9}, "model": "item/bow/4"},
{"predicate": {"custom_model_data":819, "pulling": 1, "pull": 1.0}, "model": "item/bow/5"}
]
}
For the individual models of the bow states, I've written this: (i show you just the first one because they are all the same)
{
"parent": "item/bow",
"textures": {
"layer0": "item/bow/1"
}
}
And last I have an image of the file tree I'm using at the moment:

└───minecraft
├───models
│ └───item
│ │ bow.json
│ │
│ └───bow
│ 1.json
│ 2.json
│ 3.json
│ 4.json
│ 5.json

└───textures
├───entity
│ └───illager
│ illusioner.png

└───items
└───bow
1.png
2.png
3.png
4.png
5.png
I would really appreciate it if you could help me :)
2
06/06/2019 2:09 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
For now I can't see what's wrong, may be a simple mistake in the order you put your predicates (try putting your custom lines between normal ones, a custom state right after the vanilla state).
And please, describe more precisely how it is "not working" (does it always give an error model ? Does the CustomModelData show always the vanilla bow ?).
Good luck !
1
06/06/2019 12:53 pmhistory
Level 1 : New Explorer
teflon819
teflon819's Avatar
Thanks for the reply. I'll give a try to your advice. My problems is that bows without this custom model data have the vanilla texture, but those who have the code "819" are not working, they have that black and pink error texture, not the error block, the error texture.

Here is an pic of the situation
2
05/29/2019 6:38 pmhistory
Level 17 : Journeyman Dragon
Lastphysics
Lastphysics's Avatar
Hey, just used the Custom Model Data, works good, but not on tridents. The picture in the inventory is the custom model, but the items in hand is the original one :/.
I putted a bug report, but its probably something more about an "entity" rather rhan an "item".
Do you know how to use custom model data with entities ?
1
06/01/2019 3:44 pmhistory
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Useful question, I needed to search a bit to find an answer. The trident actually has 4 different models:
- trident.json, the one you changed and renders the model in the inventory
- trident_in_hand.json, when you have it in your hand (the one that was bothering you)
- trident_throwing.json, when you raise your arm to throw it
- a hardcoded entity model for the entity that is thrown

I reccomend you reading this to learn more about it and for an example pack.
Have a nice day !
1
06/01/2019 3:54 pm
Level 69 : High Grandmaster Artist
oakar258
oakar258's Avatar
As far as I know changing entity models is not possible in vanilla - Optifine is required
1
06/01/2019 4:46 pm
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Exactly.
For the trident you'll need to work on the texture to fake a model.

BUT there is one kind of entity affected by CustomModelData: projectiles (snowball, splash potions, fireworks...).
They are rendered the same way as items, so changing the model of a projectile item will change the projectile entity.
1
06/02/2019 7:30 pm
Level 17 : Journeyman Dragon
Lastphysics
Lastphysics's Avatar
Thanks a lot, and its gonna be to difficult to do ^^ not enough time and energy for that ^^    
  
But it answered a good question I had.

Thanks again.

(If you have some time : https://www.planetminecraft.com/forums/minecraft/discussion/match-tool-question-json-conditi-588286/ , thats another post about the new 1.14 condition "match_tool" )
1
06/03/2019 11:36 am
Level 1 : New Miner
Aetheriox
Aetheriox's Avatar
when i try to use the custom model data with custom textures it always gives a missing texture cube, but when i use any ingame item (Ie iron ingot) it works, can you help?
1
06/04/2019 4:24 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
I would need to see your model file (something.json) to fully understand the problem.

But from what I read I may see what's wrong:
To apply a custom texture to an item, you'll need to create a new item model. It's not difficult,
- copy a simple item model and rename it as you want (I'll use "example.json")
- in the model file, replace the texture "layer0" by the texture you want
- in the item model file that uses CustomModelData, write the name of your newly created item model in the "model" field.

This is what your files should look like:
example.json
{
"parent": "item/generated",
"textures": {
"layer0": "folder/your_texture"
}
- note that "item/generated" renders as a normal vanilla item, "item/handheld" is used for swords and "item/handheld_rod" for sticks and blaze rods. Other items need to be manually adjusted to look right in hand but that's another story

iron_ingot.json - or whatever vanilla item you're changing
{
"parent": "item/generated",
"textures": {
"layer0": "item/iron_ingot"
},

"overrides": [
{"predicate": {"custom_model_data":<...>}, "model": "folder/example.json"}
]
}

Let me know if you still have trouble with it, have a good day !
1
06/07/2019 3:10 pm
Level 1 : New Miner
Aetheriox
Aetheriox's Avatar
my code is this
{
"parent": "item/handheld_rod",
"textures": {
"layer0": "item/carrot_on_a_stick"
},

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

]

}


i have the custom texture in the correct folder it just wont show it
1
06/05/2019 1:56 am
Level 2 : Apprentice Miner
Muttley
Muttley's Avatar
How would I go about changing the model of something like a Axe.

I tried using the example above but failed, would you be able to give me an example.



I am trying to give an axe a whole new texture, so for example I could give someone an emerald axe
1
06/05/2019 6:09 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Please read the answer I made to Aetheriox below. I explain here how to create a new item model to use with CustomModelData.
In your case, you'll just need to duplicate an axe model, name it your way and modify it's texture, then add the "overrides" in the diamond axe model with your newly created model.

Keep in mind that this is no basic ressource pack making. If you're a beginner at making .json models, I advise you to take a look at this article from minecraft gamepedia on .json models.
1
06/05/2019 6:42 pm
Level 1 : New Crafter
ada322
ada322's Avatar
Is it possible to change the model of a chestplate or any other armor?
2
06/05/2019 11:29 pm
Level 1 : New Explorer
teflon819
teflon819's Avatar
Just the item property, not the model of the armor. But you can change the texture of the armor, if that is the case.
1
06/07/2019 3:40 pm
Level 1 : New Network
KateYatsumaru
KateYatsumaru's Avatar
I tried to add custom textures but it didn't work, seems whenever I try to do anything with the model folder it breaks.
1
06/08/2019 3:21 pm
Level 39 : Artisan Dragon
dragonmaster
dragonmaster's Avatar
Can you paste what you have tried in here?
1
06/15/2019 6:33 pm
Level 1 : New Miner
dMLkhYQpzi
dMLkhYQpzi's Avatar
Hi!
So, I'm new to this and I'm wondering how to make animated item models combined with this tag?
Thanks.
1
06/15/2019 9:39 pmhistory
Level 1 : New Miner
dMLkhYQpzi
dMLkhYQpzi's Avatar
Nevermind. When you're done with modeling and texturing, just make <texture (picture) name>.png.mcmeta file next to your texture (picture) and extend your texture (picture) as you would normally do.

Create models (including free editor): https://www.youtube.com/watch?v=kQ3YftRMg5k
How to use custom item models tag: https://www.youtube.com/watch?v=iU8225raYuk&t
create textures (including free editor): https://www.youtube.com/watch?v=JEg09mNUlD0&
create textures: https://www.youtube.com/watch?v=DojdWVjGsTY
1
07/11/2019 1:50 pm
Level 50 : Grandmaster Miner
Qualthorn
Qualthorn's Avatar
Does this work for armor when they're rendered on the player?
looking in the assets folder I can't figure it out
2
07/11/2019 2:04 pm
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Sadly no. Armor is a texture rendered on the entity, you cannot change its model vanilla. BUT ! Any item put on the head will render normally.
For example, you can use Cmd with pumpkin to create custom helmets (if you disable the pumpkin overlay of course).

ps: the armor texture is in the entity folder
Have a good day !
1
07/14/2019 8:13 pm
Level 1 : New Miner
mnrock
mnrock's Avatar
Hello i am failing to understand the custom models for animated items. Even with danijel1023's response i don't understand how to do this with bows. If anyone could link me to a bow example i would be very grateful. Thanks.
2
07/15/2019 10:25 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Okay, to create an animated model you'll need to know first how to make an animated texture.

I won't start the subject here as it may need a whole post (more infos on the wiki), but just keep in mind that animating a model is just using an animated texture to show and hide parts of it.

If you just want to have different animated items, no need to worry on those details. You make an animated texture for the different states of the bow and use it for the corresponding models.
1
07/15/2019 5:29 pm
Level 48 : Master Princess
Linzi
Linzi's Avatar
Hi Geegaz ,
I can't even get the example pack to work. I have the datapack installed and I'm on the right world, but typing in that command of giving a custom iron ingot just gives me a normal, not retextured iron ingot. Am I missing something else you have to do? Is it broken in 1.14.3 or something?
1
07/16/2019 3:07 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
The example pack is a texturepack, you'll need to put it in the "resourcepacks" folder.

Then your items ingame should change texture.
1
08/16/2019 12:08 pm
Level 1 : New Miner
FoxyCutieEmperor
FoxyCutieEmperor's Avatar
Its just not working for me. I tried the example pack, I tried writing it all myself, I tried everything. Just nothing happens, closer I got was error textures and even tough I write exactly same thing now I can't even get those. I'm using version 1.14.4, here is what I tried :

diamond_sword.json
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
"{
"parent": "item/handheld",
"textures": {
"layer0": "item/diamond_sword"
},

"overrides": [
{"predicate": {"custom_model_data":10000001}, "model": "item/ancient_drowned_dagger"}
]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

didn't work so I tried the example pack, it also didn't work.
1
08/16/2019 5:00 pm
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Well here you forgot a last "}", that's why it didn't work. Also you need to put your item models in a different folder than "item", because only default models work in this folder.
1
08/18/2019 7:30 am
Level 1 : New Miner
ImNeverUsingThis
ImNeverUsingThis's Avatar
hey what program do you use to view .JSON files? I can't remember for the life of me what the old one I used was.
1
08/19/2019 12:48 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
I use Notepad++ !
It's rather basic and won't show you if you made mistakes, but it's good enough. Actually any text editor would do, even the default notepad.
1
08/19/2019 8:24 am
Level 1 : New Miner
ImNeverUsingThis
ImNeverUsingThis's Avatar
oh my god this was the one! thanks!! I used to use this when modding DST but ever since I got a new computer I haven't being doing that heh. Thanks a ton!
1
08/19/2019 1:26 am
Level 2 : Apprentice Miner
J0LLY_MINER
J0LLY_MINER's Avatar
Is there a way to make a texture pack so that you can change a block texture by renaming it in game with the anvil?
1
08/19/2019 1:27 am
Level 2 : Apprentice Miner
J0LLY_MINER
J0LLY_MINER's Avatar
I know about the cit folder with optifine. As I have it it only works with items. Is there a way to apply that procedure to blocks?
2
08/19/2019 1:52 am
Level 57 : Grandmaster Procrastinator
babbajagga
babbajagga's Avatar
I have had this exact idea the first day I got knowledge about the CIT feature, but AFAIK the answer is unfortunately a NO.



TL&DR

AFAIK no :/
1
11/11/2019 10:34 am
Level 34 : Artisan Explorer
DWBoyGamer
DWBoyGamer's Avatar
Optifine has thing called CTM folder. It allows blocks to have different texture depending of the biome they are in.
2
09/23/2019 1:32 am
Level 1 : New Explorer
Fyre_Rose
Fyre_Rose's Avatar
Hi there, i'm pretty new to this stuff so i'm not sure if this is even possible with the current system but i am trying to add a crafting recipe via a data pack and give the recipe output a custom model data but can't seem to do it.

This is what i've tried and had no luck.


{
  "type": "minecraft:crafting_shaped",
  "pattern": [
   " /P",
   "/PP"
  ],
  "key": {
   "/": {
   "item": "minecraft:stick"
  },
  "P": {
   "item": "minecraft:paper"
    }
  },
  "result": {
    "item": "minecraft:feather",
    "custom_model_data": 1,
    "count": 4
  }
}

The recipe works and spawning in a feather with the model data has the right texture but i can't get the recipe to produce a feather with the model data.

any help or tips would be greatly appreciated :)
2
09/27/2019 6:18 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Sadly, custom recipes don't accept nbt input or outputs (custom model data is stored in nbt). So you have to use workarounds to get nbt recipes working.
1
10/04/2019 10:53 pm
Level 1 : New Explorer
Fyre_Rose
Fyre_Rose's Avatar
Ah that's a shame. thanks for letting me know :D
1
10/03/2019 12:34 pm
Level 34 : Artisan Pony
MeowMeowMeowMeowMeow
MeowMeowMeowMeowMeow's Avatar
I'm looking to make a custom item textures based off the leather_leggings item (Not the actual armor!) Trying to do some fancy colored variant items with it. However I'm not sure how to go about creating new custommodeldata with items that contain multiple layers, nor can I find any tutorials online about it.

Would you happen to know how I'd be able to add new custom model datas for both layer0 and layer1(the overlay layer)?
2
10/04/2019 6:28 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Good question, I've done this recently !

I see you know about layer0 and layer1 (although iirc layer0 is the colored layer and layer1 is the base one), so won't explain it.
Then it's really simple, do as usual : create a new item model with "minecraft:item/generated" as a parent (either manually or by copying a leather armor item), and specify both "layer_0" and "layer_1" to the texture you want.
After that you can set the predicates in the base leather armor item like in the tutorial.

Hope you'll manage to get it to work, have a good day !
1
10/05/2019 11:20 am
Level 34 : Artisan Pony
MeowMeowMeowMeowMeow
MeowMeowMeowMeowMeow's Avatar
Thanks! I got it to work :) Such a great way to add in colored items without manually having to add in everyone!
1
10/22/2019 8:06 amhistory
Level 1 : New Miner
SlashHammer
SlashHammer's Avatar
Dear everyone,

I understand how to make custom data textures now! Thanks!!
How do i do this with a bow? because it has 4 stages, i cant find this info anywhere
and armor? is that possible too?
Bye
1
10/22/2019 3:12 pm
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Hello SlashHammer,

These issues may have been already discussed in the comments below, as they are very common ! But if you can't find your answer, come back to me.
Have a good day,
Geegaz
1
11/09/2019 2:21 pm
Level 28 : Expert Mage
wolfguy2005
wolfguy2005's Avatar
Is there any way to make advancement icons custom models? I got it working normally, but if I try to do it in the advancement it just shows the black purple error texture.
2
11/09/2019 8:25 pm
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
Yes, it's possible (and even recommended to show your pack is active) ! But for that, you need to specify the nbt (with your CMD) in the "icon" field of your advancement.
It would go like this :
"icon": {
"item": "your-item",
"nbt": "put-your-CMD-here"
}
1
11/10/2019 2:09 am
Level 28 : Expert Mage
wolfguy2005
wolfguy2005's Avatar
Thanks a lot. I tried it “tag” instead of “nbt”, but now it works. Another question: do you need to name the files specifically or can you name them everything, because I want more custom models for 1 block, but I’m using the names of the blocks I model, but I can’t make 2 files with the same name. Sorry for bad explanation, English isn’t my best language
1
11/10/2019 5:10 am
Level 67 : High Grandmaster Engineer
Geegaz
Geegaz's Avatar
You can name your custom model files as you want ! But be sure to reference them right in the original model.

(also, English's not my main language either :] )
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome