Skip to content

How to make a piece of armour in a Minecraft mod

Armour is an item with a material (a vanilla one such as iron, or your own) and a slot (helmet, chestplate, leggings or boots). The material decides its protection and the texture worn on the player. Before 1.21.5 the item is an ArmorItem built with the material and the slot; from 1.21.5 it is a plain Item made armour through its properties.

Works on Minecraft 1.20.1 to 26.3 on NeoForge; Minecraft 1.16.5 to 26.3 on Fabric; Minecraft 1.16.5 to 1.20.1 on Forge; Minecraft 1.12.2 on Forge. Each example was compiled against its loader and version before it shipped in Linen.

  1. Make the item with the material and the slot: an ArmorItem on 1.21.4 and older, Item.Properties#humanoidArmor on 1.21.5 and newer.
  2. Before 1.21.2, give it durability from the slot’s base durability times a multiplier; from 1.21.2 the material holds it.
  3. Register it with your class.
  4. On 1.20.5 and newer, add it to #minecraft:head_armor (chest_armor, leg_armor, foot_armor) so it takes armour enchantments.

The example uses these values. Change them in the code.

Setting In the example What it does
material IRON The vanilla material: its protection and the texture worn.
piece HELMET Where it is worn.
durability 15 The durability multiplier (iron 15, diamond 33, netherite 37).

The example mod is examplemod in the package com.example.examplemod. Use your own mod id and package.

Fabric and NeoForge 1.20.1 to 1.20.4, Forge 1.19.4 to 1.20.1

Section titled “Fabric and NeoForge 1.20.1 to 1.20.4, Forge 1.19.4 to 1.20.1”

Uses:

  • ArmorItem
  • ArmorMaterials
  • ArmorItem.Type
  • Item.Properties.durability

It uses a vanilla material, so it looks like that material when worn; a material of your own is an ArmorMaterial implementation of your own, with its own layer textures. Armour enchantments follow the ArmorItem.Type, so there is nothing to tag in 1.20.1.

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterials;
import net.minecraft.world.item.Item;
// Ruby Helmet: IRON armour worn as a HELMET.
public class RubyHelmetItem extends ArmorItem {
public RubyHelmetItem(Item.Properties properties) {
super(ArmorMaterials.IRON, ArmorItem.Type.HELMET, properties.durability(durability(ArmorItem.Type.HELMET, 15)));
}
// Vanilla's base durability per slot, times the multiplier of the material (iron 15, diamond 33).
private static int durability(ArmorItem.Type type, int multiplier) {
return multiplier * switch (type) {
case BOOTS -> 13;
case LEGGINGS -> 15;
case CHESTPLATE -> 16;
case HELMET -> 11;
};
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • ArmorItem
  • ArmorMaterials
  • ArmorItem.Type.getDurability
  • Item.Properties.durability

It uses a vanilla material, so it looks like that material when worn; a material of your own is registered in BuiltInRegistries.ARMOR_MATERIAL with its own layer textures. Add it to #minecraft:head_armor (or chest_armor, leg_armor, foot_armor) so it takes armour enchantments.

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterials;
import net.minecraft.world.item.Item;
// Ruby Helmet: IRON armour worn as a HELMET.
public class RubyHelmetItem extends ArmorItem {
public RubyHelmetItem(Item.Properties properties) {
super(ArmorMaterials.IRON, ArmorItem.Type.HELMET, properties.durability(ArmorItem.Type.HELMET.getDurability(15)));
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • ArmorItem
  • ArmorMaterials
  • ArmorType
  • ArmorMaterial.humanoidProperties

Since 1.21.2 the durability comes from the ArmorMaterial, so the durability setting is not used. Chain armour is ArmorMaterials.CHAINMAIL and turtle armour TURTLE_SCUTE. It uses a vanilla material, so it looks like that material when worn; a material of your own is an ArmorMaterial record with its own equipment asset (assets/<mod_id>/equipment/<name>.json). Add it to #minecraft:head_armor (or chest_armor, leg_armor, foot_armor) so it takes armour enchantments.

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.equipment.ArmorMaterials;
import net.minecraft.world.item.equipment.ArmorType;
// Ruby Helmet: IRON armour worn as a HELMET. Durability, protection and the worn texture all come from the ArmorMaterial.
public class RubyHelmetItem extends ArmorItem {
public RubyHelmetItem(Item.Properties properties) {
super(ArmorMaterials.IRON, ArmorType.HELMET, properties);
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • Item.Properties.humanoidArmor
  • ArmorMaterials
  • ArmorType

ArmorItem is gone in 1.21.5: a plain Item becomes armour through Item.Properties#humanoidArmor. Since 1.21.2 the durability comes from the ArmorMaterial, so the durability setting is not used. Chain armour is ArmorMaterials.CHAINMAIL and turtle armour TURTLE_SCUTE. It uses a vanilla material, so it looks like that material when worn; a material of your own is an ArmorMaterial record with its own equipment asset (assets/<mod_id>/equipment/<name>.json). Add it to #minecraft:head_armor (or chest_armor, leg_armor, foot_armor) so it takes armour enchantments.

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.equipment.ArmorMaterials;
import net.minecraft.world.item.equipment.ArmorType;
// Ruby Helmet: IRON armour worn as a HELMET. Durability, protection and the worn texture all come from the ArmorMaterial.
public class RubyHelmetItem extends Item {
public RubyHelmetItem(Item.Properties properties) {
super(properties.humanoidArmor(ArmorMaterials.IRON, ArmorType.HELMET));
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • ArmorItem
  • ArmorMaterials
  • EquipmentSlot
  • Item.Properties.durability

It uses a vanilla material, so it looks like that material when worn; a material of your own is an ArmorMaterial implementation of your own, with its own layer textures. Before 1.19.4 an armour piece is built with its EquipmentSlot instead of ArmorItem.Type.

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterials;
import net.minecraft.world.item.Item;
// Ruby Helmet: IRON armour worn as a HELMET.
public class RubyHelmetItem extends ArmorItem {
public RubyHelmetItem(Item.Properties properties) {
super(ArmorMaterials.IRON, Piece.HELMET.slot, properties.durability(Piece.HELMET.baseDurability * 15));
}
// Before 1.19.4 an armour piece is told its EquipmentSlot; this holds the slot and vanilla's base durability of each piece.
private enum Piece {
HELMET(EquipmentSlot.HEAD, 11),
CHESTPLATE(EquipmentSlot.CHEST, 16),
LEGGINGS(EquipmentSlot.LEGS, 15),
BOOTS(EquipmentSlot.FEET, 13);
private final EquipmentSlot slot;
private final int baseDurability;
Piece(EquipmentSlot slot, int baseDurability) {
this.slot = slot;
this.baseDurability = baseDurability;
}
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • ArmorItem
  • ArmorMaterials
  • EquipmentSlot
  • Item.Properties.durability

It uses a vanilla material, so it looks like that material when worn; a material of your own is an ArmorMaterial implementation of your own, with its own layer textures. Before 1.19.4 ArmorItem takes an EquipmentSlot (HEAD, CHEST, LEGS, FEET) instead of ArmorItem.Type.

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterials;
import net.minecraft.world.item.Item;
// Ruby Helmet: IRON armour worn as a HELMET.
public class RubyHelmetItem extends ArmorItem {
public RubyHelmetItem(Item.Properties properties) {
super(ArmorMaterials.IRON, Piece.HELMET.slot, properties.durability(Piece.HELMET.baseDurability * 15));
}
// Before 1.19.4 an armour piece is told its EquipmentSlot; this holds the slot and vanilla's base durability of each piece.
private enum Piece {
HELMET(EquipmentSlot.HEAD, 11),
CHESTPLATE(EquipmentSlot.CHEST, 16),
LEGGINGS(EquipmentSlot.LEGS, 15),
BOOTS(EquipmentSlot.FEET, 13);
private final EquipmentSlot slot;
private final int baseDurability;
Piece(EquipmentSlot slot, int baseDurability) {
this.slot = slot;
this.baseDurability = baseDurability;
}
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • ArmorItem
  • ArmorMaterial
  • EquipmentSlotType
  • Item.Properties.durability

It uses a vanilla material, so it looks like that material when worn; a material of your own is an ArmorMaterial implementation of your own, with its own layer textures. In 1.16.5 the piece is an EquipmentSlotType (the template maps HELMET, CHESTPLATE, LEGGINGS and BOOTS to it).

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Item;
// Ruby Helmet: IRON armour worn as a HELMET. On 1.16.5 an armour item is made from an EquipmentSlotType.
public class RubyHelmetItem extends ArmorItem {
public RubyHelmetItem(Item.Properties properties) {
super(ArmorMaterial.IRON, slot("HELMET"), properties.durability(durability(slot("HELMET"), 15)));
}
private static EquipmentSlotType slot(String piece) {
switch (piece) {
case "HELMET":
return EquipmentSlotType.HEAD;
case "CHESTPLATE":
return EquipmentSlotType.CHEST;
case "LEGGINGS":
return EquipmentSlotType.LEGS;
default:
return EquipmentSlotType.FEET;
}
}
// Vanilla's base durability per slot, times the multiplier of the material (iron 15, diamond 33).
private static int durability(EquipmentSlotType slot, int multiplier) {
int[] base = {13, 15, 16, 11}; // feet, legs, chest, head
return multiplier * base[slot.getIndex()];
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • ArmorItem
  • ArmorMaterials
  • ArmorItem.Type
  • Item.Properties.durability

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.ArmorMaterials;
import net.minecraft.world.item.Item;
// Ruby Helmet: IRON armour worn as a HELMET.
public class RubyHelmetItem extends ArmorItem {
public RubyHelmetItem(Item.Properties properties) {
super(ArmorMaterials.IRON, ArmorItem.Type.HELMET, properties.durability(durability(ArmorItem.Type.HELMET, 15)));
}
// Vanilla's base durability per slot, times the multiplier of the material (iron 15, diamond 33).
private static int durability(ArmorItem.Type type, int multiplier) {
return multiplier * switch (type) {
case BOOTS -> 13;
case LEGGINGS -> 15;
case CHESTPLATE -> 16;
case HELMET -> 11;
};
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Uses:

  • ItemArmor
  • ArmorMaterial
  • EntityEquipmentSlot
  • Item.Properties.durability

In 1.12.2 the class is ItemArmor, built with an ArmorMaterial, a render index and an EntityEquipmentSlot; its durability comes from the material.

src/main/java/com/example/examplemod/item/RubyHelmetItem.java

package com.example.examplemod.item;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor;
// Ruby Helmet: IRON armour worn as a HELMET. On 1.12.2 an armour item is made from an ArmorMaterial, a render index and an EntityEquipmentSlot.
public class RubyHelmetItem extends ItemArmor {
private static final int[] BASE_DURABILITY = {13, 15, 16, 11}; // feet, legs, chest, head
public RubyHelmetItem() {
super(ArmorMaterial.IRON, 0, slot("HELMET"));
setMaxDamage(15 * BASE_DURABILITY[slot("HELMET").getIndex()]);
}
private static EntityEquipmentSlot slot(String piece) {
switch (piece) {
case "HELMET":
return EntityEquipmentSlot.HEAD;
case "CHESTPLATE":
return EntityEquipmentSlot.CHEST;
case "LEGGINGS":
return EntityEquipmentSlot.LEGS;
default:
return EntityEquipmentSlot.FEET;
}
}
}

It’s registered like any other item, as RubyHelmetItem: see a new item.

Linen’s How-tos library has this page too, with the example for your own mod’s loader and Minecraft version. Hover a name in your code and Linen points to the how-tos that explain it. Both are free. Download Linen.