Class ToolSet
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for constructingToolSetinstances with a fluent API. -
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedToolSet(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. -
Method Summary
Modifier and TypeMethodDescriptionSupplier<net.minecraft.world.item.AxeItem> getAxe()Gets the axe item supplier from this tool set.Supplier<net.minecraft.world.item.HoeItem> getHoe()Gets the hoe item supplier from this tool set.Supplier<net.minecraft.world.item.PickaxeItem> Gets the pickaxe item supplier from this tool set.Supplier<net.minecraft.world.item.ShovelItem> Gets the shovel item supplier from this tool set.Supplier<net.minecraft.world.item.SwordItem> getSword()Gets the sword item supplier from this tool set.Methods inherited from class net.xun.armory.api.item.ItemSet
get, getAll, getPiecesForRegistration, getSetName
-
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, nevernullattackDamage- map of attack damage bonuses per tool type, nevernullattackSpeed- map of attack speed modifiers per tool type, nevernullpropertiesSupplier- supplier for item properties applied to all tools, nevernullcustomizer- strategy for creating individual tool items, nevernullattributeHelper- helper for applying combat attributes, nevernull- Throws:
NullPointerException- if any required parameter isnullIllegalArgumentException- if attack maps are incomplete or invalid
-
-
Method Details
-
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, nevernull
-
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, nevernull
-
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, nevernull
-
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, nevernull
-
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, nevernull
-