Package net.xun.armory.api.item.tools
Record Class ToolPieceType
java.lang.Object
java.lang.Record
net.xun.armory.api.item.tools.ToolPieceType
- Record Components:
nameSuffix- the suffix appended to the set name to form the registry IDdefaultStats- the default attack damage and speed for this pieceitemFactory- the factory that creates the actual item instancepropertiesModifier- a per‑piece modifier forItem.PropertiesadditionalAttributes- a per‑piece consumer for additional attribute modifiers
- All Implemented Interfaces:
PieceType
public record ToolPieceType(String nameSuffix, ToolStats defaultStats, ToolItemFactory itemFactory, 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 tool piece (e.g., sword, axe) with its own naming,
default stats, item factory, and property modifiers.
Instances are typically defined as constants (e.g., VanillaToolPieces.SWORD)
and used to build a ToolSet. 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
ConstructorsConstructorDescriptionToolPieceType(String nameSuffix, ToolStats defaultStats, ToolItemFactory itemFactory, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes) Creates an instance of aToolPieceTyperecord class. -
Method Summary
Modifier and TypeMethodDescriptionConsumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> Returns the value of theadditionalAttributesrecord component.static ToolPieceType.BuilderFluent builder forToolPieceType.net.minecraft.world.item.ItemcreateItem(ToolContext context, net.minecraft.world.item.Item.Properties properties) Creates an item using this piece's factory and the provided context/properties.Returns the value of thedefaultStatsrecord 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 theitemFactoryrecord component.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.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
-
ToolPieceType
public ToolPieceType(String nameSuffix, ToolStats defaultStats, ToolItemFactory itemFactory, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes) Creates an instance of aToolPieceTyperecord class.- Parameters:
nameSuffix- the value for thenameSuffixrecord componentdefaultStats- the value for thedefaultStatsrecord componentitemFactory- the value for theitemFactoryrecord 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(ToolContext context, net.minecraft.world.item.Item.Properties properties) Creates an item using this piece's factory and the provided context/properties. This method does NOT apply any properties modifiers; it expects the properties to already be final. -
builder
Fluent builder forToolPieceType. -
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
-
defaultStats
Returns the value of thedefaultStatsrecord component.- Returns:
- the value of the
defaultStatsrecord component
-
itemFactory
Returns the value of theitemFactoryrecord component.- Returns:
- the value of the
itemFactoryrecord 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
-