Record Class ArmorMaterial

java.lang.Object
java.lang.Record
net.minecraft.item.ArmorMaterial
Record Components:
defense -
enchantability -
equipSound -
repairIngredient -
layers -
toughness -
knockbackResistance -

public record ArmorMaterial(Map<ArmorItem.Type,Integer> defense, int enchantability, RegistryEntry<SoundEvent> equipSound, Supplier<Ingredient> repairIngredient, List<ArmorMaterial.Layer> layers, float toughness, float knockbackResistance) extends Record
Defines the material stats of an ArmorItem item.

To view available vanilla armor materials, visit ArmorMaterials.

Mappings:
Namespace Name
named net/minecraft/item/ArmorMaterial
intermediary net/minecraft/class_1741
official csh
named defense
intermediary comp_2298
official b
named enchantability
intermediary comp_2299
official c
named equipSound
intermediary comp_2300
official d
named repairIngredient
intermediary comp_2301
official e
named layers
intermediary comp_2302
official f
named toughness
intermediary comp_2303
official g
named knockbackResistance
intermediary comp_2304
official h
  • Field Details

    • defense

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

      private final int enchantability
      The field for the enchantability record component.
    • equipSound

      private final RegistryEntry<SoundEvent> equipSound
      The field for the equipSound record component.
    • repairIngredient

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

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

      private final float toughness
      The field for the toughness record component.
    • knockbackResistance

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

      public static final com.mojang.serialization.Codec<RegistryEntry<ArmorMaterial>> CODEC
      Mappings:
      Namespace Name Mixin selector
      named CODEC Lnet/minecraft/item/ArmorMaterial;CODEC:Lcom/mojang/serialization/Codec;
      intermediary field_48840 Lnet/minecraft/class_1741;field_48840:Lcom/mojang/serialization/Codec;
      official a Lcsh;a: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.ADD_VALUE 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
      named getProtection Lnet/minecraft/item/ArmorMaterial;getProtection(Lnet/minecraft/item/ArmorItem$Type;)I
      intermediary method_48403 Lnet/minecraft/class_1741;method_48403(Lnet/minecraft/class_1738$class_8051;)I
      official a Lcsh;a(Lcsg$a;)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
    • enchantability

      public int enchantability()
      Returns the value of the enchantability record component.
      Returns:
      the value of the enchantability record component
    • equipSound

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

      public Supplier<Ingredient> repairIngredient()
      Returns the value of the repairIngredient record component.
      Returns:
      the value of the repairIngredient record component
    • layers

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

      public float toughness()
      Returns the value of the toughness record component.
      Returns:
      the value of the toughness record component
    • knockbackResistance

      public float knockbackResistance()
      Returns the value of the knockbackResistance record component.
      Returns:
      the value of the knockbackResistance record component