Package net.xun.armory.api.item.tools
Class ToolMetaDataLookup
java.lang.Object
net.xun.armory.api.item.tools.ToolMetaDataLookup
A lookup utility for retrieving
ToolMetaData associated with tool items.
This class stores metadata for tool items created via the Armory API, allowing
retrieval of piece type, context, and customizer from an Item or ItemStack.
The lookup uses identity-based mapping (IdentityHashMap) to avoid collisions
with item subclasses or overridden equals/hashCode.
This class is not intended to be instantiated.
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontains(net.minecraft.world.item.Item item) Checks whether the given item has associated tool metadata.static booleancontains(net.minecraft.world.item.ItemStack stack) Checks whether the item in the given stack has associated tool metadata.static ToolMetaDataget(net.minecraft.world.item.Item item) Retrieves the tool metadata for the given item.static ToolMetaDataget(net.minecraft.world.item.ItemStack stack) Retrieves the tool metadata for the item in the given stack.static voidregister(net.minecraft.world.item.Item item, ToolMetaData instance) Registers tool metadata for the given item.
-
Method Details
-
register
Registers tool metadata for the given item.- Parameters:
item- the tool item to associate with metadatainstance- the metadata instance (must not benull)- Throws:
NullPointerException- if either argument isnull
-
get
Retrieves the tool metadata for the given item.- Parameters:
item- the item to look up- Returns:
- the metadata, or
nullif not found
-
get
Retrieves the tool metadata for the item in the given stack.- Parameters:
stack- the stack containing the item- Returns:
- the metadata, or
nullif not found
-
contains
public static boolean contains(net.minecraft.world.item.Item item) Checks whether the given item has associated tool metadata.- Parameters:
item- the item to check- Returns:
trueif metadata exists,falseotherwise
-
contains
public static boolean contains(net.minecraft.world.item.ItemStack stack) Checks whether the item in the given stack has associated tool metadata.- Parameters:
stack- the stack containing the item- Returns:
trueif metadata exists,falseotherwise
-