Interface ItemPieceFactory<P,T extends net.minecraft.world.item.Item>
- Type Parameters:
P- the type representing individual pieces (typically an enum)T- the type of item created by this factory, must extendItem
- All Known Implementing Classes:
ArmorFactory,ToolFactory
This interface provides the mechanism for creating specific item instances based on piece identifiers. Implementations are responsible for:
- Mapping piece identifiers to their corresponding
PieceType - Creating the actual item instances with appropriate configuration
Internal Use Only: This interface is part of the internal API and is not intended for direct implementation by mod developers. Breaking changes may occur without notice.
Implementations are typically used by ItemSet to lazily create
individual pieces of armor sets, tool sets, or other related item collections.
- Since:
- 2.0.0
- See Also:
-
Method Summary
-
Method Details
-
getPieceType
Retrieves the piece type metadata for a given piece identifier.This method provides the naming and classification information needed for proper item registration and identification within a set.
- Parameters:
piece- the piece identifier, nevernull- Returns:
- the piece type metadata for the specified piece, never
null - Throws:
NullPointerException- ifpieceisnullIllegalArgumentException- ifpieceis not recognized
-
create
Creates an item instance for the specified piece.This method is responsible for constructing the actual item with all necessary properties, attributes, and configuration. The returned item should be fully configured and ready for registration and use.
- Parameters:
piece- the piece identifier for which to create an item, nevernull- Returns:
- a newly created item instance for the specified piece,
never
null - Throws:
NullPointerException- ifpieceisnullIllegalStateException- if the item cannot be created due to invalid configuration or missing dependencies
-