一.创建一个枚举类实现 ArmorMaterial 接口,并且实现重写方法

public enum ExampleArmorMaterial implements ArmorMaterial {
    private final String name;
    private final int durabilityMultiplier;
    private final EnumMap<ArmorItem.Type, Integer> protectionFunctionForType;
    private final int enchantmentValue;
    private final SoundEvent sound;
    private final float toughness;
    private final float knockbackResistance;
    private final Supplier<Ingredient> repairIngredient;
    private static final EnumMap<ArmorItem.Type, Integer> HEALTH_FUNCTION_FOR_TYPE = 
            Util.make(new EnumMap<>(ArmorItem.Type.class), map -> {
                map.put(ArmorItem.Type.BOOTS, 100);
                map.put(ArmorItem.Type.LEGGINGS,100);
                map.put(ArmorItem.Type.CHESTPLATE,100);
                map.put(ArmorItem.Type.HELMET, 100);
            }); 
    ExampleArmorMaterial(
            String name,
            int durabilityMultiplier,
            EnumMap<ArmorItem.Type, Integer> protectionFunctionForType,
            int enchantmentValue,
            SoundEvent sound,
            float toughness,
            float knockbackResistance,
            Supplier<Ingredient> repairIngredient
    ){
        this.name=name;
        this.durabilityMultiplier=durabilityMultiplier;
        this.protectionFunctionForType=protectionFunctionForType;
        this.enchantmentValue=enchantmentValue;
        this.sound=sound;
        this.toughness=toughness;
        this.knockbackResistance=knockbackResistance;
        this.repairIngredient=repairIngredient;
    }

    @Override
    public int getDurabilityForType(ArmorItem.Type type) {
        return HEALTH_FUNCTION_FOR_TYPE.get(type) * this.durabilityMultiplier;    //倍数与基础耐久相乘得到总耐久
    }

    @Override
    public int getDefenseForType(ArmorItem.Type type) {
        return this.protectionFunctionForType.get(type);
    }

    @Override
    public int getEnchantmentValue() {
        return enchantmentValue;
    }

    @Override
    public SoundEvent getEquipSound() {
        return sound;
    }

    @Override
    public Ingredient getRepairIngredient() {
        return repairIngredient.get();
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public float getToughness() {
        return toughness;
    }

    @Override
    public float getKnockbackResistance() {
        return knockbackResistance;
    }
}

变量含义:

二.在类中创建自定义的材质实例,基本与工具相同

Example("example",
            50,     //耐久倍数
            Util.make(new EnumMap<>(ArmorItem.Type.class),map->{    //护甲表
        map.put(ArmorItem.Type.BOOTS, 20);     //鞋
        map.put(ArmorItem.Type.LEGGINGS, 20);  //裤
        map.put(ArmorItem.Type.CHESTPLATE, 20);//甲
        map.put(ArmorItem.Type.HELMET, 20);    //头
    }),20,  //附魔等级
            SoundEvents.ARMOR_EQUIP_DIAMOND,    //声音
            10.0F,  //韧性
            1.0F,   //击退抗性百分比
            ()->Ingredient.of(Registry.EXAMPLE_ITEM_01.get())); //修复物品

三.最后注册装备

    public static final Supplier<Item> EXAMPLE_HELMET=ITEMS.register("example_helmet",
            ()->new ArmorItem(ExampleArmorMaterial.Example,ArmorItem.Type.HELMET,new Item.Properties()));
    public static final Supplier<Item> EXAMPLE_CHESTPLATE=ITEMS.register("example_chestplate",
            ()->new ArmorItem(ExampleArmorMaterial.Example,ArmorItem.Type.HELMET,new Item.Properties()));
    public static final Supplier<Item> EXAMPLE_LEGGINGS=ITEMS.register("example_leggings",
            ()->new ArmorItem(ExampleArmorMaterial.Example,ArmorItem.Type.HELMET,new Item.Properties()));
    public static final Supplier<Item> EXAMPLE_BOOTS=ITEMS.register("example_boots",
            ()->new ArmorItem(ExampleArmorMaterial.Example,ArmorItem.Type.HELMET,new Item.Properties()));