Class ToolSet.Builder
java.lang.Object
net.xun.lib.common.api.item.tools.ToolSet.Builder
- Enclosing class:
ToolSet
Builder for constructing
ToolSet instances with flexible configuration.
Allows setting per-tool attributes, item properties, and creation behavior.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(String name, net.minecraft.world.item.Tier tier, AttributeHelper attributeHelper) Constructs a new builder for a tool set. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Constructs the configuredToolSet.withConfiguration(ToolConfigurator configurator) Sets custom tool creation logic.withItemProperties(net.minecraft.world.item.Item.Properties properties) Caution: Sets shared item properties for all tools.withItemPropertiesSupplier(Supplier<net.minecraft.world.item.Item.Properties> propertiesSupplier) Sets item properties using a supplier (called per-tool during construction).withToolStats(float[] damages, float[] speeds) Configures attack stats for all tools using arrays.withToolStats(ToolType type, float damage, float speed) Configures attack stats for a specific tool type.Applies vanilla Minecraft balance values to all tools.
-
Constructor Details
-
Builder
Constructs a new builder for a tool set.- Parameters:
name- Base name for tools (appended with tool-specific suffixes)tier- Material tier for all toolsattributeHelper- Helper for applying item attributes to properties
-
-
Method Details
-
withToolStats
Configures attack stats for all tools using arrays. Array order must matchToolType.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
Configures attack stats for a specific tool type.- Parameters:
type- Target tool typedamage- Attack damage bonus (added to tier's base damage)speed- Attack speed modifier- Returns:
- This builder for chaining
-
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
Caution: Sets shared item properties for all tools. May cause attribute conflicts if properties are mutated internally. PreferwithItemPropertiesSupplier(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 thanwithItemProperties(net.minecraft.world.item.Item.Properties)for tool sets.- Parameters:
propertiesSupplier- Supplier providing base properties- Returns:
- This builder for chaining
-
withConfiguration
Sets custom tool creation logic.- Parameters:
configurator- Tool creation strategy implementation- Returns:
- This builder for chaining
-
build
Constructs the configuredToolSet.- Returns:
- New tool set instance
-