Class ToolSet.Builder

java.lang.Object
net.xun.lib.common.api.item.tools.ToolSet.Builder
Enclosing class:
ToolSet

public static class ToolSet.Builder extends Object
Builder for constructing ToolSet instances with flexible configuration. Allows setting per-tool attributes, item properties, and creation behavior.
  • Constructor Details

    • Builder

      public Builder(String name, net.minecraft.world.item.Tier tier, AttributeHelper attributeHelper)
      Constructs a new builder for a tool set.
      Parameters:
      name - Base name for tools (appended with tool-specific suffixes)
      tier - Material tier for all tools
      attributeHelper - Helper for applying item attributes to properties
  • Method Details

    • withToolStats

      public ToolSet.Builder withToolStats(float[] damages, float[] speeds)
      Configures attack stats for all tools using arrays. Array order must match ToolType.values().
      Parameters:
      damages - Attack damage bonuses (added to tier's base damage)
      speeds - Attack speed modifiers
      Returns:
      This builder for chaining
      Throws:
      IllegalArgumentException - If array lengths don't match tool types
    • withToolStats

      public ToolSet.Builder withToolStats(ToolType type, float damage, float speed)
      Configures attack stats for a specific tool type.
      Parameters:
      type - Target tool type
      damage - Attack damage bonus (added to tier's base damage)
      speed - Attack speed modifier
      Returns:
      This builder for chaining
    • withVanillaBalance

      public ToolSet.Builder withVanillaBalance()
      Applies vanilla Minecraft balance values to all tools. (iron tools stats) Uses standard damage bonuses and attack speeds from vanilla.
      Returns:
      This builder for chaining
    • withItemProperties

      public ToolSet.Builder withItemProperties(net.minecraft.world.item.Item.Properties properties)
      Caution: Sets shared item properties for all tools. May cause attribute conflicts if properties are mutated internally. Prefer withItemPropertiesSupplier(java.util.function.Supplier<net.minecraft.world.item.Item.Properties>) for multi-tool sets.
      Parameters:
      properties - Base properties for all tools
      Returns:
      This builder for chaining
    • withItemPropertiesSupplier

      public ToolSet.Builder withItemPropertiesSupplier(Supplier<net.minecraft.world.item.Item.Properties> propertiesSupplier)
      Sets item properties using a supplier (called per-tool during construction). Safer than withItemProperties(net.minecraft.world.item.Item.Properties) for tool sets.
      Parameters:
      propertiesSupplier - Supplier providing base properties
      Returns:
      This builder for chaining
    • withConfiguration

      public ToolSet.Builder withConfiguration(ToolConfigurator configurator)
      Sets custom tool creation logic.
      Parameters:
      configurator - Tool creation strategy implementation
      Returns:
      This builder for chaining
    • build

      public ToolSet build()
      Constructs the configured ToolSet.
      Returns:
      New tool set instance