Class Item
java.lang.Object
fr.hytale.loader.api.Item
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 -
Method Summary
Modifier and TypeMethodDescriptionGets the block key associated with this item, if any.getId()Gets the item's ID.com.hypixel.hytale.server.core.inventory.ItemStackGets the native Hytale item stack instance.intGets the item's quantity.booleanisBroken()Checks if the item is broken.booleanisEquivalentType(Item item) Checks if this item is of an equivalent type to another item.doubleGets the maximum durability of the item.toString()
-
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
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
-
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
Gets the block key associated with this item, if any.- Returns:
- the block key, or null if not applicable
-
isEquivalentType
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
-