Package net.xun.armory.api.item.armor
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 (nevernull)material- the armor material holder (protection, toughness) (nevernull)durabilityFactor- the multiplier for durability (must be non-negative; default 0 uses material default)propertiesModifier- a global modifier for item properties (nevernull)additionalAttributes- a global consumer for extra attribute modifiers (nevernull)
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
ConstructorsConstructorDescriptionArmorContext(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 aArmorContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionConsumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> Returns the value of theadditionalAttributesrecord component.net.minecraft.world.item.Item.PropertiesapplyProperties(ArmorPieceType piece, net.minecraft.world.item.Item.Properties base) Applies all property modifiers (set-level and piece-level) and builds the final attribute modifiers.intReturns the value of thedurabilityFactorrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material()Returns the value of thematerialrecord component.UnaryOperator<net.minecraft.world.item.Item.Properties> Returns the value of thepropertiesModifierrecord component.setName()Returns the value of thesetNamerecord component.final StringtoString()Returns a string representation of this record class.
-
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 aArmorContextrecord class.- Parameters:
setName- the value for thesetNamerecord componentmaterial- the value for thematerialrecord componentdurabilityFactor- the value for thedurabilityFactorrecord componentpropertiesModifier- the value for thepropertiesModifierrecord componentadditionalAttributes- the value for theadditionalAttributesrecord 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 newItem.Propertiesinstance 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 benull)base- the base properties (must not benull)- Returns:
- a new properties instance with all modifications applied
- Throws:
NullPointerException- if either argument isnull
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
setName
Returns the value of thesetNamerecord component.- Returns:
- the value of the
setNamerecord component
-
material
public net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material()Returns the value of thematerialrecord component.- Returns:
- the value of the
materialrecord component
-
durabilityFactor
public int durabilityFactor()Returns the value of thedurabilityFactorrecord component.- Returns:
- the value of the
durabilityFactorrecord component
-
propertiesModifier
Returns the value of thepropertiesModifierrecord component.- Returns:
- the value of the
propertiesModifierrecord component
-
additionalAttributes
public Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes()Returns the value of theadditionalAttributesrecord component.- Returns:
- the value of the
additionalAttributesrecord component
-