Class Item

java.lang.Object
fr.hytale.loader.api.Item

public class Item extends Object
HytaleLoader wrapper for the native Hytale ItemStack class.

This class provides a simplified API for interacting with items.

Since:
1.0.1
Version:
1.0.4
Author:
HytaleLoader
  • Constructor Summary

    Constructors
    Constructor
    Description
    Item(com.hypixel.hytale.server.core.inventory.ItemStack nativeItemStack)
    Constructs a new Item wrapper from an existing ItemStack.
    Item(String id, int quantity)
    Constructs a new Item with the specified ID and quantity.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the block key associated with this item, if any.
    Gets the item's ID.
    com.hypixel.hytale.server.core.inventory.ItemStack
    Gets the native Hytale item stack instance.
    int
    Gets the item's quantity.
    boolean
    Checks if the item is broken.
    boolean
    Checks if this item is of an equivalent type to another item.
    double
    Gets the maximum durability of the item.
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Item

      public Item(com.hypixel.hytale.server.core.inventory.ItemStack nativeItemStack)
      Constructs a new Item wrapper from an existing ItemStack.
      Parameters:
      nativeItemStack - the native Hytale item stack instance
    • Item

      public Item(String id, int quantity)
      Constructs a new Item with the specified ID and quantity.
      Parameters:
      id - the item ID (e.g., "hytale:sword")
      quantity - the quantity
  • Method Details

    • getNativeItemStack

      public com.hypixel.hytale.server.core.inventory.ItemStack getNativeItemStack()
      Gets the native Hytale item stack instance.
      Returns:
      the wrapped native item stack
    • getId

      public String getId()
      Gets the item's ID.
      Returns:
      the item ID
    • getQuantity

      public int getQuantity()
      Gets the item's quantity.
      Returns:
      the quantity
    • isBroken

      public boolean isBroken()
      Checks if the item is broken.
      Returns:
      true if the item is broken, false otherwise
    • maxDurability

      public double maxDurability()
      Gets the maximum durability of the item.
      Returns:
      the maximum durability
    • getBlockKey

      public String getBlockKey()
      Gets the block key associated with this item, if any.
      Returns:
      the block key, or null if not applicable
    • isEquivalentType

      public boolean isEquivalentType(Item item)
      Checks if this item is of an equivalent type to another item.

      This checks if the item IDs match, ignoring quantity and other metadata.

      Parameters:
      item - the other item to compare with
      Returns:
      true if the items are of equivalent type
    • toString

      public String toString()
      Overrides:
      toString in class Object