JSON Item Models

on in Forge Mods for 1.12 • 1 min read

Models for items and blocks are created using Mojang’s fairly simple JSON format. We’re going to create a simple item model for our copper ingot.

Before we do this, we’ll need to add our copper ingot texture. Download the copper ingot texture from here and save it to src/main/resources/assets/tutorial/textures/items/ingot_copper.png so we can use it from our model.

Now we’ll create a simple JSON model and save it to src/main/resources/assets/tutorial/models/item/ingot_copper.json

{
	"parent": "item/generated",
	"textures": {
		"layer0": "tutorial:items/ingot_copper"
	}
}

Let’s go over what each bit does:

  • parent: specifies which model to use as the parent. We’re using item/generated which is a code model that is part of Minecraft that generates that nice 3D look that items have.
  • textures: specifies all the textures to use for this model.
  • layer0: Our model only has one texture so we only need to specify one layer.
  • tutorial:items/ingotCopper: There are two important parts of this bit.
    • tutorial specifies that the texture is part of the tutorial domain.
    • items/ingotCopper specifies what path the texture is at.
    • These are all combined to get the entire path to the texture assets/tutorial/textures/items/ingot_copper.png

Now our item has a nice texture and nice model in-game!

Copper Ingot Model/Texture Screenshot