What is CustomModelData?

Custom_Model_Data is an numeric NBT Tag in the JSON item models in Minecraft, we can use it to create multiple variations of the same item in one resource pack.

We can therefor define a number to a new model, if said number is greater then or equal to the one before it, our new model will be used instead.

This is why you often see item models being summoned with /give @p diamond_sword{CustomModelData:104230}
In this case you can change the 104230 to any number and if it matches or is greater then a defined Custom_Model_Data predicate (number before it) we get that model in-game.

A few beginner tips I have would be:

  • Always use lowercase letters when dealing with file paths and names in a resource pack.
  • You can not have a CustomModelData defined in a file JSON that is lower then the one before it, it breaks the system.
  • Use a randomized number to start your CustomModelData defining, if you later buy or download models it will probably be easier to merge the packs into one.

Example pack and how to use it

Let’s create a pack that looks like this (file structure).

If you wish to use the exact same files as I do, you can get them here: Helmet Model

The order of how the files work together when it comes to CustomModelData:

feather.json is where we can define a link to a new model with a specific CustomModelData number, example:

{
	"parent": "item/generated",
	"textures": {
		"layer0": "item/feather"
	},
	"overrides": [
		{ "predicate": {  "custom_model_data": 1 }, "model": "item/helmet1"}
	]
}

Here we simply say that the Parent is the default Feather model in Minecraft (“item/generated”), but if we spawn in a feather with CustomModelData 1 or higher it should have the model item/helmet1.json.

We technically define a bunch of rules to override the basic model.

helmet1.json defines which texture (png) file we use, how the model is shaped and everything else so that we can spawn our item.

{
	"credit": "Made with Blockbench",
	"texture_size": [64, 64],
	"textures": {
		"0": "item/helmet1",
		"particle": "item/helmet1"
	},
	"elements": [
..... (This file is 350 lines long)

Here you can see that the texture png that the model requires is located at item/helmet1 (we never define that it is a .png).

Now we can spawn our custom model in-game using:

/give @p feather{CustomModelData:1}

If you want to add more models onto the feather file, please do it like this:

{
	"parent": "item/generated",
	"textures": {
		"layer0": "item/feather"
	},
	"overrides": [
		{ "predicate": {  "custom_model_data": 1 }, "model": "item/helmet1"},
		{ "predicate": {  "custom_model_data": 2 }, "model": "item/helmet2"},
		{ "predicate": {  "custom_model_data": 3 }, "model": "item/helmet3"}

	]
}

Make sure you notice that we added a comma after each model line except the last one.

If you want to read all day about the subject I recommend the wiki page on models.