Record Class ArmorMaterial

java.lang.Object
java.lang.Record
net.minecraft.world.item.ArmorMaterial

public record ArmorMaterial(Map<ArmorItem.Type,Integer> defense, int enchantmentValue, Holder<SoundEvent> equipSound, Supplier<Ingredient> repairIngredient, List<ArmorMaterial.Layer> layers, float toughness, float knockbackResistance) extends Record
  • Field Details

    • defense

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

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

      private final Holder<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<Holder<ArmorMaterial>> CODEC
  • Constructor Details

    • ArmorMaterial

      public ArmorMaterial(Map<ArmorItem.Type,Integer> defense, int enchantmentValue, Holder<SoundEvent> equipSound, Supplier<Ingredient> repairIngredient, List<ArmorMaterial.Layer> layers, float toughness, float knockbackResistance)
      Creates an instance of a ArmorMaterial record class.
      Parameters:
      defense - the value for the defense record component
      enchantmentValue - the value for the enchantmentValue record component
      equipSound - the value for the equipSound record component
      repairIngredient - the value for the repairIngredient record component
      layers - the value for the layers record component
      toughness - the value for the toughness record component
      knockbackResistance - the value for the knockbackResistance record component
  • Method Details

    • getDefense

      public int getDefense(ArmorItem.Type p_328867_)
    • 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 o)
      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:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o 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
    • enchantmentValue

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

      public Holder<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