Record Class ArmorPieceType

java.lang.Object
java.lang.Record
net.xun.armory.api.item.armor.ArmorPieceType
Record Components:
nameSuffix - the suffix appended to the set name to form the registry ID (must start with '_' and not be blank)
vanillaType - the corresponding ArmorItem.Type (never null)
customizer - optional customizer override (may be null, then uses set-level)
propertiesModifier - a per‑piece modifier for Item.Properties (never null)
additionalAttributes - a per‑piece consumer for additional attribute modifiers (never null)
All Implemented Interfaces:
PieceType

public record ArmorPieceType(String nameSuffix, net.minecraft.world.item.ArmorItem.Type vanillaType, ArmorCustomizer customizer, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes) extends Record implements PieceType
Represents a specific type of armor piece (e.g., helmet, chestplate) with its own naming, vanilla type, customizer, and property modifiers.

Instances are typically defined as constants (e.g., VanillaArmorPieces.HELMET) and used to build an ArmorSet. Each piece defines how an item is created and how its properties and attributes are configured.

Since:
3.0.0
  • Constructor Details

    • ArmorPieceType

      public ArmorPieceType(String nameSuffix, net.minecraft.world.item.ArmorItem.Type vanillaType, ArmorCustomizer customizer, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes)
      Creates an instance of a ArmorPieceType record class.
      Parameters:
      nameSuffix - the value for the nameSuffix record component
      vanillaType - the value for the vanillaType record component
      customizer - the value for the customizer record component
      propertiesModifier - the value for the propertiesModifier record component
      additionalAttributes - the value for the additionalAttributes record component
  • Method Details

    • getNameSuffix

      public String getNameSuffix()
      Description copied from interface: PieceType
      Gets the naming suffix for this piece type.

      The suffix is appended to a base name to create the full registry name for an item. It should typically start with an underscore ("_") to separate it from the base name, following Minecraft's naming conventions.

      Examples:

      • "_sword" for swords
      • "_helmet" for helmets
      • "_chestplate" for chestplates
      Specified by:
      getNameSuffix in interface PieceType
      Returns:
      the naming suffix for this piece type, never null
    • createItem

      public net.minecraft.world.item.Item createItem(ArmorContext context, net.minecraft.world.item.Item.Properties properties)
      Creates a standard ArmorItem using the context's material and the vanilla type.

      This method does not apply durability; it is expected that the caller (usually the ArmorCustomizer) will set the durability on the properties.

      Parameters:
      context - the armor context (never null)
      properties - the final item properties (never null)
      Returns:
      a new ArmorItem instance
    • builder

      public static ArmorPieceType.Builder builder(String suffix)
      Fluent builder for ArmorPieceType.
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • nameSuffix

      public String nameSuffix()
      Returns the value of the nameSuffix record component.
      Returns:
      the value of the nameSuffix record component
    • vanillaType

      public net.minecraft.world.item.ArmorItem.Type vanillaType()
      Returns the value of the vanillaType record component.
      Returns:
      the value of the vanillaType record component
    • customizer

      public ArmorCustomizer customizer()
      Returns the value of the customizer record component.
      Returns:
      the value of the customizer record component
    • propertiesModifier

      public UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier()
      Returns the value of the propertiesModifier record component.
      Returns:
      the value of the propertiesModifier record component
    • additionalAttributes

      public Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes()
      Returns the value of the additionalAttributes record component.
      Returns:
      the value of the additionalAttributes record component