Minecraft Wiki
Advertisement

Ever since the ability to rename and modify items, command artists have been trying to add their own custom items to vanilla Minecraft. In snapshot 18w43a, the CustomModelData tag was added, allowing to change the model of any item to be changed depending on an NBT value. Here is an example of a custom item in vanilla Minecraft.

How can I create my own custom items, without replacing default items?

Choosing an item[]

In 1.14, it is unfortunately still impossible to actually add items to Minecraft, like it is impossible to add entities or blocks. However, it is possible to disguise an existing item as a new one. Therefore, the first step in making your own custom items is choosing what item you are going to use.

Clock[]

Clocks have a property that most items in Minecraft don't have: it has no functionality. It does change texture depending on daytime, but that relies only on its model, and in fact, with a resource pack, you could do exact same with, say, a string or a cooked potato. They are stackable, they cannot be placed, crafted into another item, cooked or used in any way, which is why they're often the best option for custom items.

Carrot on a stick[]

The Carrot on a Stick can be used to make your own usable items, because its use stat can be used with scoreboard objectives to detect right-clicking. It does have functionality, however, the ability to attract pigs and to guide them, which can be annoying if you just want to make a new tool or weapon.

Knowledge book[]

The Knowledge Book has the property of vanishing when it is used, which can be useful if you want to make consumable items.

Applying a texture[]

Once you have chosen an item, you probably want to give it a different look, so that it just doesn't look like a default item. This can be done using models in resource packs. For this, we are going to use the CustomModelData tag. This tag acts as a key that indicates to resource packs what model they should use.

Setting CustomModelData[]

Setting CustomModelData on your item is pretty easy. You just have to indicate any integer (from -2147483648 and 2147483647) that you will use later in your model.

give @s minecraft:stone{CustomModelData:123}

Note: I recommend using a unique prefix so that multiple datapacks don't use the same value. There's a big chance two datapacks may use 1 for CustomModelData, but two datapacks are never going to use 714309. I personally use values between 1512001 and 1512999 because 1512 stands for the AEL in my username.

Setup your resource pack[]

Once you know what CustomModelData value you are going to use, you will have to specify that same value in a model, so that the game knows what texture to use for your item. You will therefore need to edit the item model of the item you chose.

Finding the default model[]

This model can be found in .minecraft/versions/[current version]/[current version].jar/assets/minecraft/models/item/[item].json.

Note: To navigate in the jar file, you may need to open the archive with a software such as WinRar or 7Zip.

Here is, by example, the model of the structure void:

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

Adding overrides[]

The next step is to add 'overrides', which specify cases when another model should be used when the item meets certain conditions. Here, the condition is that the item has a specific CustomModelData value. There are other conditions you can use, like the remaining durability of the item by example, but I'll focus on CustomModelData.

{
  "parent": "item/generated",
  "textures": {
    "layer0": "item/structure_void"
  },
  "overrides": [
    { "predicate": { "custom_model_data": 123 }, "model": "mypack:item/shiny_podzol" },
    { "predicate": { "custom_model_data": 124 }, "model": "mypack:item/slime_sword" }
  ]
}

The syntax is fairly simple to understand. There are however a few things that you should pay attention to:

  • The name of the predicate ("custom_model_data", the condition) is not cased the same way as the corresponding tag, CustomModelData. If you write it the wrong way, your model will simply not work.
  • The first override says "If this item has a CustomModelData value of 123 or more, apply this model. That means if you had a structure void with a CustomModelData value of 138, it would also get its texture changed.
  • Overrides apply from to bottom. The last override whose conditions are met will apply. The order of your overrides is therefore important: if I had switched the two overrides in the example model, an item with a CustomModelData value of 124 would look like a shiny_podzol and not like a slime_sword!

Creating a new model[]

As you can see, the model example uses two models: mypack:item/shiny_podzol and mypack:item/slime_sword. You cannot use overrides to directly apply a new texture, you will need to create new models for each of your items. If you look higher, at the default structure void model, you can however see that item models are easy to make, if you just want to apply a custom texture. Here is my model for the slime_sword:

{
  "parent": "item/generated",
  "textures": {
    "layer0": "mypack:item/slime_sword"
  }
}

Saving files[]

If you haven't created a resource pack before, this is where it could be confusing. As you probably understood, the models "link" at each other - by example, when the structure void model uses mypack:item/shiny_podzol, it looks for a model file in assets/mypack/models/item named shiny_podzol.json. Therefore, the way you name models and textures has to be consistent with what you write in your models.

Here is the structure you should have in your resource pack:

  • Resource pack
    • assets
      • minecraft
        • models
          • item
            • (the item you replaced).json
            • structure_void.json (by example)
      • mypack (can be anything)
        • models
          • item
            • (your custom item).json
            • shiny_podzol.json (by example)
        • textures
          • item
            • (your texture).png
            • shiny_podzol.png (by example)
    • pack.mcmeta

Customising your item[]

Once you have applied your texture to the item, there are still multiple ways you can change it to look different from others.

Name[]

To change the name of your item, you can use the Name NBT field in display:

give @s dead_bush{display:{Name:'"George H.W. Bush"'}}

As of 1.14, Name uses JSON text component syntax (like /tellraw). This means you can even add colour or even make the name not italic (like most default items):

give @s paper{display:{Name:'{"text":"Tissue","italic":false}'}}

Behavior[]

Adding data[]

Advertisement