Class ToolSet

java.lang.Object
net.xun.armory.api.item.ItemSet<ToolPieceType,net.minecraft.world.item.Item>
net.xun.armory.api.item.tools.ToolSet

public class ToolSet extends ItemSet<ToolPieceType,net.minecraft.world.item.Item>
A specialized ItemSet representing a collection of tools that share a common Tier.

A ToolSet associates each ToolPieceType with tool-specific ToolStats, while the Tier provides the shared material properties used by the tools in the set.

Tool creation is delegated to a ToolCustomizer, allowing individual sets to create specialized tool implementations without requiring subclasses of ToolSet. Item properties and additional attribute modifiers can also be configured globally through the builder.

Tools are exposed as lazy suppliers inherited from ItemSet. This allows the set to be constructed independently of the final registered item instances.

Since:
1.0.0
See Also:
  • Constructor Details

    • ToolSet

      protected ToolSet(String name, net.minecraft.world.item.Tier tier, List<ToolPieceType> pieces, Map<ToolPieceType,ToolStats> statsByPiece, UnaryOperator<net.minecraft.world.item.Item.Properties> propertiesModifier, Consumer<net.minecraft.world.item.component.ItemAttributeModifiers.Builder> additionalAttributes, ToolCustomizer customizer)
      Constructs a tool set with the specified configuration.

      The supplied tool statistics are associated with their corresponding piece types and are used by the tool creation factory. The supplied properties modifier and additional attribute consumer are shared by all tools created by this set.

      Parameters:
      name - the base name used to generate tool registry names
      tier - the shared material tier for the tools
      pieces - the tool pieces included in the set
      statsByPiece - the tool statistics associated with each piece
      propertiesModifier - modifier applied to item properties during creation
      additionalAttributes - consumer used to add additional attribute modifiers
      customizer - strategy responsible for creating the tool instances
      Throws:
      NullPointerException - if name, tier, pieces, statsByPiece, propertiesModifier, additionalAttributes, or customizer is null
  • Method Details

    • getTier

      public net.minecraft.world.item.Tier getTier()
      Returns the Tier that defines the material properties for all tools in this set.
      Returns:
      the tier, never null
    • getStats

      public ToolStats getStats(ToolPieceType piece)
      Retrieves the tool stats (attack damage and speed) for a specific piece.
      Parameters:
      piece - the tool piece type (must belong to this set)
      Returns:
      the stats for that piece
      Throws:
      IllegalArgumentException - if piece is not part of this set
    • getContext

      public ToolContext getContext()
      Returns the immutable context object that holds all configuration for this tool set.
      Returns:
      the tool context, never null
    • getSword

      public Supplier<net.minecraft.world.item.Item> getSword()
    • getAxe

      public Supplier<net.minecraft.world.item.Item> getAxe()
    • getPickaxe

      public Supplier<net.minecraft.world.item.Item> getPickaxe()
    • getShovel

      public Supplier<net.minecraft.world.item.Item> getShovel()
    • getHoe

      public Supplier<net.minecraft.world.item.Item> getHoe()
    • builder

      public static ToolSet.Builder builder(String name, net.minecraft.world.item.Tier tier)