Record Class ArmorContext

java.lang.Object
java.lang.Record
net.xun.armory.api.item.armor.ArmorContext
Record Components:
setName - the base name of the armor set (never null)
material - the armor material holder (protection, toughness) (never null)
durabilityFactor - the multiplier for durability (must be non-negative; default 0 uses material default)
propertiesModifier - a global modifier for item properties (never null)
additionalAttributes - a global consumer for extra attribute modifiers (never null)

public record ArmorContext(String setName, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int durabilityFactor, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes) extends Record
Immutable context object holding all configuration parameters for an armor set.

This record encapsulates the set name, armor material, durability factor, and property modifiers used during armor creation. It provides a method to apply these configurations to Item.Properties and build the final attribute modifiers.

Since:
3.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    ArmorContext(String setName, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int durabilityFactor, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes)
    Creates an instance of a ArmorContext record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder>
    Returns the value of the additionalAttributes record component.
    net.minecraft.world.item.Item.Properties
    applyProperties(ArmorPieceType piece, net.minecraft.world.item.Item.Properties base)
    Applies all property modifiers (set-level and piece-level) and builds the final attribute modifiers.
    int
    Returns the value of the durabilityFactor record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial>
    Returns the value of the material record component.
    UnaryOperator<net.minecraft.world.item.Item.Properties>
    Returns the value of the propertiesModifier record component.
    Returns the value of the setName record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ArmorContext

      public ArmorContext(String setName, net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int durabilityFactor, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes)
      Creates an instance of a ArmorContext record class.
      Parameters:
      setName - the value for the setName record component
      material - the value for the material record component
      durabilityFactor - the value for the durabilityFactor record component
      propertiesModifier - the value for the propertiesModifier record component
      additionalAttributes - the value for the additionalAttributes record component
  • Method Details

    • applyProperties

      public net.minecraft.world.item.Item.Properties applyProperties(ArmorPieceType piece, net.minecraft.world.item.Item.Properties base)
      Applies all property modifiers (set-level and piece-level) and builds the final attribute modifiers. Returns a new Item.Properties instance with the combined attributes.

      This method does not set durability; that is handled by the customizer when constructing the actual ArmorItem.

      Parameters:
      piece - the armor piece type (must not be null)
      base - the base properties (must not be null)
      Returns:
      a new properties instance with all modifications applied
      Throws:
      NullPointerException - if either argument is null
    • 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.
    • setName

      public String setName()
      Returns the value of the setName record component.
      Returns:
      the value of the setName record component
    • material

      public net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material()
      Returns the value of the material record component.
      Returns:
      the value of the material record component
    • durabilityFactor

      public int durabilityFactor()
      Returns the value of the durabilityFactor record component.
      Returns:
      the value of the durabilityFactor 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