Package net.xun.armory.api.item.armor
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 correspondingArmorItem.Type(nevernull)customizer- optional customizer override (may benull, then uses set-level)propertiesModifier- a per‑piece modifier forItem.Properties(nevernull)additionalAttributes- a per‑piece consumer for additional attribute modifiers (nevernull)
- 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
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionArmorPieceType(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 aArmorPieceTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptionConsumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> Returns the value of theadditionalAttributesrecord component.static ArmorPieceType.BuilderFluent builder forArmorPieceType.net.minecraft.world.item.ItemcreateItem(ArmorContext context, net.minecraft.world.item.Item.Properties properties) Creates a standardArmorItemusing the context's material and the vanilla type.Returns the value of thecustomizerrecord component.final booleanIndicates whether some other object is "equal to" this one.Gets the naming suffix for this piece type.final inthashCode()Returns a hash code value for this object.Returns the value of thenameSuffixrecord component.UnaryOperator<net.minecraft.world.item.Item.Properties> Returns the value of thepropertiesModifierrecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.world.item.ArmorItem.TypeReturns the value of thevanillaTyperecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.xun.armory.impl.item.PieceType
registryName
-
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 aArmorPieceTyperecord class.- Parameters:
nameSuffix- the value for thenameSuffixrecord componentvanillaType- the value for thevanillaTyperecord componentcustomizer- the value for thecustomizerrecord componentpropertiesModifier- the value for thepropertiesModifierrecord componentadditionalAttributes- the value for theadditionalAttributesrecord component
-
-
Method Details
-
getNameSuffix
Description copied from interface:PieceTypeGets 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:
getNameSuffixin interfacePieceType- 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 standardArmorItemusing 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 (nevernull)properties- the final item properties (nevernull)- Returns:
- a new
ArmorIteminstance
-
builder
Fluent builder forArmorPieceType. -
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. All components in this record class are compared withObjects::equals(Object,Object). -
nameSuffix
Returns the value of thenameSuffixrecord component.- Returns:
- the value of the
nameSuffixrecord component
-
vanillaType
public net.minecraft.world.item.ArmorItem.Type vanillaType()Returns the value of thevanillaTyperecord component.- Returns:
- the value of the
vanillaTyperecord component
-
customizer
Returns the value of thecustomizerrecord component.- Returns:
- the value of the
customizerrecord 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
-