Record Class ArmorMaterial

java.lang.Object
java.lang.Record
net.minecraft.item.ArmorMaterial
Record Components:
defense -
getEnchantability -
getEquipSound -
getRepairIngredient -
layers -
getToughness -
getKnockbackResistance -

public record ArmorMaterial(Map<ArmorItem.Type,Integer> defense, int getEnchantability, RegistryEntry<SoundEvent> getEquipSound, Supplier<Ingredient> getRepairIngredient, List<ArmorMaterial.Layer> layers, float getToughness, float getKnockbackResistance) extends Record
Defines the material stats of an ArmorItem item.

To view available vanilla armor materials, visit ArmorMaterials.

Mappings:
Namespace Name
official cnz
intermediary net/minecraft/class_1741
named net/minecraft/item/ArmorMaterial
official b
intermediary comp_2298
named defense
official c
intermediary comp_2299
named getEnchantability
official d
intermediary comp_2300
named getEquipSound
official e
intermediary comp_2301
named getRepairIngredient
official f
intermediary comp_2302
named layers
official g
intermediary comp_2303
named getToughness
official h
intermediary comp_2304
named getKnockbackResistance
  • Field Details

    • defense

      private final Map<ArmorItem.Type,Integer> defense
      The field for the defense record component.
    • getEnchantability

      private final int getEnchantability
      The field for the getEnchantability record component.
    • getEquipSound

      private final RegistryEntry<SoundEvent> getEquipSound
      The field for the getEquipSound record component.
    • getRepairIngredient

      private final Supplier<Ingredient> getRepairIngredient
      The field for the getRepairIngredient record component.
    • layers

      private final List<ArmorMaterial.Layer> layers
      The field for the layers record component.
    • getToughness

      private final float getToughness
      The field for the getToughness record component.
    • getKnockbackResistance

      private final float getKnockbackResistance
      The field for the getKnockbackResistance record component.
    • CODEC

      public static final com.mojang.serialization.Codec<RegistryEntry<ArmorMaterial>> CODEC
      Mappings:
      Namespace Name Mixin selector
      official a Lcnz;a:Lcom/mojang/serialization/Codec;
      intermediary field_48840 Lnet/minecraft/class_1741;field_48840:Lcom/mojang/serialization/Codec;
      named CODEC Lnet/minecraft/item/ArmorMaterial;CODEC:Lcom/mojang/serialization/Codec;
  • Constructor Details

  • Method Details

    • getProtection

      public int getProtection(ArmorItem.Type type)
      Returns the amount of armor protection points offered by an ArmorItem using this ArmorMaterial while it is worn by a player.

      The protection value returned here is applied as an EntityAttributeModifier to a player wearing the ArmorItem piece via the EntityAttributeModifier.Operation.ADDITION modifier.

      Parameters:
      type - the ArmorItem.Type of the Item with this ArmorMaterial
      Returns:
      the amount of armor protection points offered by an ArmorItem with this ArmorMaterial
      Mappings:
      Namespace Name Mixin selector
      official a Lcnz;a(Lcny$a;)I
      intermediary method_48403 Lnet/minecraft/class_1741;method_48403(Lnet/minecraft/class_1738$class_8051;)I
      named getProtection Lnet/minecraft/item/ArmorMaterial;getProtection(Lnet/minecraft/item/ArmorItem$Type;)I
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object object)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      object - the object with which to compare
      Returns:
      true if this object is the same as the object argument; false otherwise.
    • defense

      public Map<ArmorItem.Type,Integer> defense()
      Returns the value of the defense record component.
      Returns:
      the value of the defense record component
    • getEnchantability

      public int getEnchantability()
      Returns the base enchantment value used by ArmorItem with this material.

      By default, ArmorItem will override Item.getEnchantability() and delegate the call back to this method.

      A higher return value will result in better enchantment results when using an Enchanting Table. The highest enchantability value in vanilla is Netherite, at 37.

      Returns:
      the enchantment value sent back to Item.getEnchantability() for armor using this material
      Mappings:
      Namespace Name Mixin selector
      official b Lcnz;b()I
      intermediary comp_2299 Lnet/minecraft/class_1741;comp_2299()I
      named getEnchantability Lnet/minecraft/item/ArmorMaterial;getEnchantability()I
    • getEquipSound

      public RegistryEntry<SoundEvent> getEquipSound()
      Returns the value of the getEquipSound record component.
      Returns:
      the value of the getEquipSound record component
    • getRepairIngredient

      public Supplier<Ingredient> getRepairIngredient()
      Returns the Ingredient used to repair items using this ArmorMaterial.

      By default, ArmorItem will delegate Item.canRepair(ItemStack, ItemStack) back to this method.

      Returns:
      the Ingredient required to repair items with this ArmorMaterial
      Mappings:
      Namespace Name Mixin selector
      official d Lcnz;d()Ljava/util/function/Supplier;
      intermediary comp_2301 Lnet/minecraft/class_1741;comp_2301()Ljava/util/function/Supplier;
      named getRepairIngredient Lnet/minecraft/item/ArmorMaterial;getRepairIngredient()Ljava/util/function/Supplier;
    • layers

      public List<ArmorMaterial.Layer> layers()
      Returns the value of the layers record component.
      Returns:
      the value of the layers record component
    • getToughness

      public float getToughness()
      Returns the toughness value of an ArmorItem piece using this ArmorMaterial.

      ArmorItem will cover the value returned here into the EntityAttributes.GENERIC_ARMOR_TOUGHNESS statistic with the EntityAttributeModifier.Operation.ADDITION modifier type.

      Returns:
      the toughness value of any ArmorItem using this ArmorMaterial
      Mappings:
      Namespace Name Mixin selector
      official f Lcnz;f()F
      intermediary comp_2303 Lnet/minecraft/class_1741;comp_2303()F
      named getToughness Lnet/minecraft/item/ArmorMaterial;getToughness()F
    • getKnockbackResistance

      public float getKnockbackResistance()
      Returns the knockback resistance value of an ArmorItem piece using this ArmorMaterial.

      ArmorItem will cover the value returned here into the EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE statistic with the EntityAttributeModifier.Operation.ADDITION modifier type.

      Returns:
      the knockback resistance value of an ArmorItem piece using this ArmorMaterial
      Mappings:
      Namespace Name Mixin selector
      official g Lcnz;g()F
      intermediary comp_2304 Lnet/minecraft/class_1741;comp_2304()F
      named getKnockbackResistance Lnet/minecraft/item/ArmorMaterial;getKnockbackResistance()F