Class ToolMetaDataLookup

java.lang.Object
net.xun.armory.api.item.tools.ToolMetaDataLookup

public final class ToolMetaDataLookup extends Object
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 Type
    Method
    Description
    static boolean
    contains(net.minecraft.world.item.Item item)
    Checks whether the given item has associated tool metadata.
    static boolean
    contains(net.minecraft.world.item.ItemStack stack)
    Checks whether the item in the given stack has associated tool metadata.
    get(net.minecraft.world.item.Item item)
    Retrieves the tool metadata for the given item.
    get(net.minecraft.world.item.ItemStack stack)
    Retrieves the tool metadata for the item in the given stack.
    static void
    register(net.minecraft.world.item.Item item, ToolMetaData instance)
    Registers tool metadata for the given item.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • register

      public static void register(net.minecraft.world.item.Item item, ToolMetaData instance)
      Registers tool metadata for the given item.
      Parameters:
      item - the tool item to associate with metadata
      instance - the metadata instance (must not be null)
      Throws:
      NullPointerException - if either argument is null
    • get

      public static ToolMetaData get(net.minecraft.world.item.Item item)
      Retrieves the tool metadata for the given item.
      Parameters:
      item - the item to look up
      Returns:
      the metadata, or null if not found
    • get

      public static ToolMetaData get(net.minecraft.world.item.ItemStack stack)
      Retrieves the tool metadata for the item in the given stack.
      Parameters:
      stack - the stack containing the item
      Returns:
      the metadata, or null if 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:
      true if metadata exists, false otherwise
    • 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:
      true if metadata exists, false otherwise