Class ToolSet

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

public class ToolSet extends ItemSet<ToolType,net.minecraft.world.item.Item>
Represents a complete set of tools including sword, axe, pickaxe, shovel, and hoe.

This class provides a convenient abstraction for creating and managing a full tool set with consistent properties and naming across all pieces. Each tool is lazily initialized upon first access and can be retrieved individually or as a complete collection.

Usage Example (with NeoForge) :


 // Create a diamond tool set with vanilla balance
 ToolSet diamondTools = new ToolSet.Builder("diamond", Tiers.DIAMOND)
     .withVanillaBalance()
     .build();

 // Register all tool pieces
 Map<ResourceLocation, Supplier<Item>> items = diamondTools.getItemsForRegistration("mymod");
 items.forEach((id, supplier) -> ITEMS.register(id.getPath(), supplier));

 // Access individual tools (with proper type casting)
 Supplier<SwordItem> sword = diamondTools.getSword();
 Supplier<AxeItem> axe = diamondTools.getAxe();
 
Since:
1.0.0
See Also:
  • Constructor Details

    • ToolSet

      protected ToolSet(String name, net.minecraft.world.item.Tier tier, EnumMap<ToolType,Float> attackDamage, EnumMap<ToolType,Float> attackSpeed, Supplier<net.minecraft.world.item.Item.Properties> propertiesSupplier, ToolCustomizer customizer, AttributeHelper attributeHelper)
      Constructs a new ToolSet with the specified configuration.
      Parameters:
      name - base name for all tools in the set (e.g., "diamond")
      tier - material tier for all tools, never null
      attackDamage - map of attack damage bonuses per tool type, never null
      attackSpeed - map of attack speed modifiers per tool type, never null
      propertiesSupplier - supplier for item properties applied to all tools, never null
      customizer - strategy for creating individual tool items, never null
      attributeHelper - helper for applying combat attributes, never null
      Throws:
      NullPointerException - if any required parameter is null
      IllegalArgumentException - if attack maps are incomplete or invalid
  • Method Details

    • getSword

      public Supplier<net.minecraft.world.item.SwordItem> getSword()
      Gets the sword item supplier from this tool set.

      The supplier will create the sword item upon first invocation and cache the result for subsequent calls.

      Returns:
      supplier providing the registered SwordItem, never null
    • getAxe

      public Supplier<net.minecraft.world.item.AxeItem> getAxe()
      Gets the axe item supplier from this tool set.

      The supplier will create the axe item upon first invocation and cache the result for subsequent calls.

      Returns:
      supplier providing the registered AxeItem, never null
    • getPickaxe

      public Supplier<net.minecraft.world.item.PickaxeItem> getPickaxe()
      Gets the pickaxe item supplier from this tool set.

      The supplier will create the pickaxe item upon first invocation and cache the result for subsequent calls.

      Returns:
      supplier providing the registered PickaxeItem, never null
    • getHoe

      public Supplier<net.minecraft.world.item.HoeItem> getHoe()
      Gets the hoe item supplier from this tool set.

      The supplier will create the hoe item upon first invocation and cache the result for subsequent calls.

      Returns:
      supplier providing the registered HoeItem, never null
    • getShovel

      public Supplier<net.minecraft.world.item.ShovelItem> getShovel()
      Gets the shovel item supplier from this tool set.

      The supplier will create the shovel item upon first invocation and cache the result for subsequent calls.

      Returns:
      supplier providing the registered ShovelItem, never null