Package net.xun.armory.api.item.armor
Class ArmorFactory
java.lang.Object
net.xun.armory.api.item.armor.ArmorFactory
- All Implemented Interfaces:
ItemPieceFactory<ArmorType,net.minecraft.world.item.ArmorItem>
public class ArmorFactory
extends Object
implements ItemPieceFactory<ArmorType,net.minecraft.world.item.ArmorItem>
Factory implementation that creates armor items for a complete armor set.
This class bridges the ArmorSet configuration with the piece-wise creation
pattern required by ItemPieceFactory. It applies shared configuration
(material, durability, properties) to each armor piece while delegating the actual
item creation to an ArmorCustomizer.
Lifecycle: Instances are created by ArmorSet and used
during registration to lazily create individual armor pieces.
- Since:
- 2.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionArmorFactory(net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int durabilityFactor, Supplier<net.minecraft.world.item.Item.Properties> propertiesSupplier, ArmorCustomizer configurator) Constructs a new armor factory with the specified configuration. -
Method Summary
-
Constructor Details
-
ArmorFactory
public ArmorFactory(net.minecraft.core.Holder<net.minecraft.world.item.ArmorMaterial> material, int durabilityFactor, Supplier<net.minecraft.world.item.Item.Properties> propertiesSupplier, ArmorCustomizer configurator) Constructs a new armor factory with the specified configuration.- Parameters:
material- holder for the armor material, nevernulldurabilityFactor- multiplier for base material durabilitypropertiesSupplier- supplier for item properties (called once per piece)configurator- customizer for armor item creation, nevernull- Throws:
NullPointerException- if any required parameter isnull
-
-
Method Details
-
getPieceType
Returns the piece type, which for armor is theArmorTypeitself.- Specified by:
getPieceTypein interfaceItemPieceFactory<ArmorType,net.minecraft.world.item.ArmorItem> - Parameters:
piece- the armor piece type- Returns:
- the piece type unchanged
-
create
Creates an armor item for the specified piece type.This method:
- Obtains fresh item properties from the supplier
- Delegates to the configured
ArmorCustomizerfor item creation - Returns a fully configured armor item
- Specified by:
createin interfaceItemPieceFactory<ArmorType,net.minecraft.world.item.ArmorItem> - Parameters:
piece- the type of armor piece to create- Returns:
- a configured armor item for the specified piece
- Throws:
NullPointerException- ifpieceisnullIllegalStateException- if the customizer fails to create the item
-