80
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.
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
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
Create an account or sign in to comment.
148
THANKS!
i'm making a datapack with custom weapons but the method you showed doesnt really work as intended
screenshot
code
screenshot
code
Pretty sutre the katana image belongs in textures/items not models/items
Thank you so much!
Ive been trying to think of ways I can let players use my items in survival, since you can't use commands. Ive figured out how to add them into loot tables of mobs and loot chests, but I still don't know how to make them craftable, even if I made custom crafting recipes there are only so many recipes I could come up with and there are over 250 items in one of my packs and some 400 in the other.
With optifine I can craft them by renaming the base item on an anvil, do you think there is some way in which I could do the same thing in vanilla?
With optifine I can craft them by renaming the base item on an anvil, do you think there is some way in which I could do the same thing in vanilla?
Currently it's not possible to craft items with NBT in a regular crafting table, so we have a few workarounds.
The easiest (and most common) method is by using a knowledge book as the output item - you might've seen it in a lot of packs, when you have recipes that require you to click on the knowledge book to get the item.
For that you need:
- an advancement to detect when the recipe is unlocked
- a function that resets the advancement and recipe
- a loot table to give the item (can also be a simple /give in the previous function)
Then, just put the function and loot table as rewards for the achievement.
The pros - you can craft the item directly in the regular crafting table, it works seamlessly and is quite easy to implement. The cons though - you can't see the item you're crafting, the recipe will never be in the recipe book, and a popup will appear every time.
The oldest method is floor crafting, but it's really not recommended as it can get very laggy if not implemented properly.
The most advanced method is making a custom crafter. It's very technical so I won't go in the details, but it's by far the most flexible method since you can make custom UIs, new types of crafting - nearly anything you want. Thankfully there are initiatives to make the creation of a custom crafter easier - I'd recommend checking out SmithedCrafter, a datapack that adds a fully functionnal crafter to which you can add your own recipes very easily !
If you need help with any of these - here are the Minecraft Commands and the Datapack Center discord server, they have a lot of great datapackers that will be able to help you !
The easiest (and most common) method is by using a knowledge book as the output item - you might've seen it in a lot of packs, when you have recipes that require you to click on the knowledge book to get the item.
For that you need:
- an advancement to detect when the recipe is unlocked
- a function that resets the advancement and recipe
- a loot table to give the item (can also be a simple /give in the previous function)
Then, just put the function and loot table as rewards for the achievement.
The pros - you can craft the item directly in the regular crafting table, it works seamlessly and is quite easy to implement. The cons though - you can't see the item you're crafting, the recipe will never be in the recipe book, and a popup will appear every time.
The oldest method is floor crafting, but it's really not recommended as it can get very laggy if not implemented properly.
The most advanced method is making a custom crafter. It's very technical so I won't go in the details, but it's by far the most flexible method since you can make custom UIs, new types of crafting - nearly anything you want. Thankfully there are initiatives to make the creation of a custom crafter easier - I'd recommend checking out SmithedCrafter, a datapack that adds a fully functionnal crafter to which you can add your own recipes very easily !
If you need help with any of these - here are the Minecraft Commands and the Datapack Center discord server, they have a lot of great datapackers that will be able to help you !
Thank you! I will look into all of these. Hopefully mojang will add nbt options later.
By custom crafting recipes do you mean using the official ones (for the vanilla crafting table)?
If you want to rename and change the custommodeldata of your output items, you cannot do so without a custom crafter or floor crafting
If you want to rename and change the custommodeldata of your output items, you cannot do so without a custom crafter or floor crafting
I'd recommend using a custom namespace for the custom model and textures. Seems cleaner to me, and more consistent with the standards for datapacks (which I don't see why they wouldn't apply to resource packs as well).
The compatibility issue can be easily solved with a top-level cohesion resource pack that contains just the override models, with an override for each data value that's meant to be included. One should keep an eye out for CustomModelData ID collisions, though, and adjust things accordingly if necessary.
The compatibility issue can be easily solved with a top-level cohesion resource pack that contains just the override models, with an override for each data value that's meant to be included. One should keep an eye out for CustomModelData ID collisions, though, and adjust things accordingly if necessary.
Well, if I understood your comment properly you're only half-right.
Datapacks need a custom namespace and resourcepacks don't, but it's true organizing them in the same way as datapack can be cleaner.
There is an effort to avoid CMD ID collision and general datapack compatibility, thanks to a website created by Boomber, where each datapacker can give themselves a 4-digits ID to use in front of all their models. It allows manual merging of packs (creating a single resourcepack with all the overrides) without CMD ID collisions.
But about compatibility, the problem has already been studied and what you propose doesn't work. From what I gather, either you suggest putting things in namespaces so they can merge easily, either you suggest we use a toplevel pack with all possible overrides ?
Well, for the first solution, model overrides don't merge. If you have one pack that has overrides in the stick model, other packs that also have overrides in the stick model will take priority in the vertical order.
For the second idea, it's not bad but you still need to specify a path to the custom model in the override. So, it's just pushing the problem back.
... if your idea was something else, sorry but it wouldn't work either. It's been bugging the entire datapack community for a long time, and it's not easy to solve.
Datapacks need a custom namespace and resourcepacks don't, but it's true organizing them in the same way as datapack can be cleaner.
There is an effort to avoid CMD ID collision and general datapack compatibility, thanks to a website created by Boomber, where each datapacker can give themselves a 4-digits ID to use in front of all their models. It allows manual merging of packs (creating a single resourcepack with all the overrides) without CMD ID collisions.
But about compatibility, the problem has already been studied and what you propose doesn't work. From what I gather, either you suggest putting things in namespaces so they can merge easily, either you suggest we use a toplevel pack with all possible overrides ?
Well, for the first solution, model overrides don't merge. If you have one pack that has overrides in the stick model, other packs that also have overrides in the stick model will take priority in the vertical order.
For the second idea, it's not bad but you still need to specify a path to the custom model in the override. So, it's just pushing the problem back.
... if your idea was something else, sorry but it wouldn't work either. It's been bugging the entire datapack community for a long time, and it's not easy to solve.
how do you find the custom model data on one single item
how do i add multiple textures?
for example i want two different textures for a carrot on a stick
for example i want two different textures for a carrot on a stick
Thank you so much!
thank you very much i wanted to make a club penguin character in game and now i can
Is there a way to create a model file that works for all items (on version 1.8)? I wanted to make it so all items look a certain way in first person but the only way i found was to make each item it's own model file :/
I created my own model but I don't know how to fix the position, so far I haven't found a way.
{
"parent": "item/handheld",
"textures": {
"layer0": "item/custom/obs/obsidian_longsword"
},
"display": {
"firstperson_righthand": {
"translation": [ 0, 1, -3 ],
"rotation": [ 45, 90, 0 ],
"scale": [ 2, 2, 1 ]
},
"thirdperson_righthand": {
"translation": [ 0, 4, 2],
"rotation": [ 45, 90, 0 ],
"scale": [ 2, 2, 1 ]
},
"firstperson_leftthand": {
"translation": [ 0, 1, -3 ],
"rotation": [ -45, 90, 0 ],
"scale": [ 2, 2, 1 ]
},
"thirdperson_lefthand": {
"translation": [ 0, 4, 2 ],
"rotation": [ -45, 90, 0 ],
"scale": [ 2, 2, 1 ]
}
}
}
Try raising the second value in each "translation" field !
The 3 numbers are an array for 3D translation, so changing the 2nd value will change the Y position of the model.
The 3 numbers are an array for 3D translation, so changing the 2nd value will change the Y position of the model.
thanks , it worked
cool!
Does this exist on bedrock? I want 2 make something for my friends who use bedrock. Can't find anything on whether or not it exists.
Nope, this is only for Java Edition resource packs (1.14+)
hi um, I'm trying to make a custom 3d model from iron ax to my model but when I get it with this code ..
/give @s iron_axe{CustomModelData:192007}
but I just see the item is not visible but there (has no texture at all. not purple black box can you help me? please help me
this is the model "hammer.json":
{
"credit": "Made with Blockbench",
"parent": "minecraft:item/handheld",
"textures": {
"0": "item/19_gray",
"particle": "item/19_gray"
},
"elements": [
{
"from": [8, -10, 8],
"to": [9, 9, 9],
"faces": {
"north": {"uv": [0, 0, 1, 16], "texture": "#0"},
"east": {"uv": [0, 0, 1, 16], "texture": "#0"},
"south": {"uv": [0, 0, 1, 16], "texture": "#0"},
"west": {"uv": [0, 0, 1, 16], "texture": "#0"},
"up": {"uv": [0, 0, 1, 1], "texture": "#0"},
"down": {"uv": [0, 0, 1, 1], "texture": "#0"}
}
},
{
"from": [7, 9, 4],
"to": [10, 12, 13],
"faces": {
"north": {"uv": [0, 0, 3, 3], "texture": "#0"},
"east": {"uv": [0, 0, 9, 3], "texture": "#0"},
"south": {"uv": [0, 0, 3, 3], "texture": "#0"},
"west": {"uv": [0, 0, 9, 3], "texture": "#0"},
"up": {"uv": [0, 0, 3, 9], "texture": "#0"},
"down": {"uv": [0, 0, 3, 9], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [-1.25, 11.75, 0.5],
"scale": [1.7793, 1.63672, 1.77148]
},
"thirdperson_lefthand": {
"translation": [-1.25, 11.75, 0.5],
"scale": [1.7793, 1.63672, 1.77148]
},
"firstperson_righthand": {
"translation": [-1.25, 11.75, 0.5],
"scale": [1.7793, 1.63672, 1.77148]
},
"firstperson_lefthand": {
"translation": [-1.25, 11.75, 0.5],
"scale": [1.7793, 1.63672, 1.77148]
},
"ground": {
"rotation": [-86.75, 0, 0],
"translation": [-1.25, 3, 0.5],
"scale": [1.7793, 1.63672, 1.77148]
},
"gui": {
"rotation": [0, 60, 0],
"translation": [0, 5.75, 0]
},
"fixed": {
"rotation": [0, 90, 0],
"translation": [0, 4.25, 0],
"scale": [1.25977, 1.19922, 1]
}
}
}
and this is the iron axe code
{
"parent": "item/generated",
"textures": {
"layer0": "item/iron_axe"
},
"overrides":
[
{ "predicate": { "custom_model_data":192007}, "model": "item/hammer" }
]
}
Did you put both "hammer.json" and "iron_axe.json" under /assets/minecraft/models/item/ ?
so how would i change the texture for armor being worn depending on the {CustomModelData} tag, if possible?
Hi whoever is reading this!
I am trying to make a resource pack that goes with a data pack I am working on. I have tried multiple methods with this resource pack and some of the responses in the comments. My texture isn't coming up yet I have replicated the example .json file identically except with my presonal twists please help me.
here is my code
{
"parent": "item/generated",
"textures": {
"layer0": "item/iron_ingot"
},
"overrides": [
{"predicate": {"custom_model_data":1234567}, "model": "assets/minecraft/models/item/swords/excalibur"}
]
}
I have tried adjusting multiple things but nothing is working? Is this a 1.16 issue or am I just plain stupid?
I am trying to make a resource pack that goes with a data pack I am working on. I have tried multiple methods with this resource pack and some of the responses in the comments. My texture isn't coming up yet I have replicated the example .json file identically except with my presonal twists please help me.
here is my code
{
"parent": "item/generated",
"textures": {
"layer0": "item/iron_ingot"
},
"overrides": [
{"predicate": {"custom_model_data":1234567}, "model": "assets/minecraft/models/item/swords/excalibur"}
]
}
I have tried adjusting multiple things but nothing is working? Is this a 1.16 issue or am I just plain stupid?
Update I have done something that has now made it a black & purple box
Please help me whoever is reading this asap
Please help me whoever is reading this asap
{
"parent": "item/generated",
"textures": {
"layer0": "item/iron_sword"
},
"overrides": [
{"predicate": {"custom_model_data":1}, "model": "item/excalibur"}
]
}
Just found that to remove the purple & black cube in your hand the item needs its own json file
Here is an example for copy & paste-ing
Make sure it is in its own json file and is named after the texture
Here is an example for copy & paste-ing
{
"parent": "item/handheld",
"textures": {
"layer0": "item/texture_name_here"
}
}
Make sure it is in its own json file and is named after the texture
I have a problem and I have no idea what can I do.
The Problem is to make a custom model data texture on a shield
The Problem is to make a custom model data texture on a shield
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:
In assets/minecraft/models/item:
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"}
]
}
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"}
]
}
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"}
]
}
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 :/
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 :/
What's the code in custom_sword.json?
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/custom
Hope this helped!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
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
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
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.
But you can still add custom models for music discs though, even if it's not gonna change the music they play.
tysm
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"
}
]
}
Did you pass it through a json validator to see if there are any json mistakes ? I use this one (link).
Thx
Edit: I ran the code through and fixed it, but it still shows up as a textureless cube in my hand
Edit: I ran the code through and fixed it, but it still shows up as a textureless cube in my hand
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)
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)
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
I'm trying to make a craftable weapon for survival that i can craft
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.
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
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
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:
Note that usually, in the few models that need 2 layers, layer1 displays on top of layer0.
{
"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.
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.
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.
It's not possible, you would have to use Custom Model Data for that.
view more replies ( 38 )