ItemStack
Implements
- ItemInstance
Index
Constructors
constructor
Returns ItemStack
Properties
count
data
optionalextra
id
Methods
addEnchant
Adds a new enchantment to the item. Creates new ItemExtraData instance if it doesn't exist.
Parameters
id: number
enchantment id, one of the Native.Enchantment constants
level: number
enchantment level, generally between 1 and 5
Returns void
applyDamage
Applies damage to the item and destroys it if its max damage reached
Parameters
damage: number
amount to apply
Returns void
clear
Sets all stack values to 0.
Returns void
copy
Creates a copy of current ItemStack object
Returns ItemStack
a created copy of the ItemStack
decrease
Decreases stack count by specified value.
Parameters
count: number
amount to decrease
Returns void
getCustomName
Returns string
item's custom name
getEnchantLevel
Parameters
id: number
enchantment id, one of the Native.Enchantment constants
Returns number
level of the specified enchantment
getEnchants
Returns {}
all the enchantments of the item in the readable format
[key number]: number
getItemInstance
Returns Nullable<ItemBase>
instance of item class if the item was added by BlockEngine, null otherwise.
getMaxDamage
Returns number
maximum damage value for the item
getMaxStack
Returns number
maximum stack size for the item
isEmpty
Returns boolean
true if all stack values are empty, false otherwise
isEnchanted
Returns boolean
true if the item is enchanted, false otherwise
removeAllEnchants
Removes all the enchantments of the item
Returns void
removeEnchant
Removes enchantments by its id
Parameters
id: number
enchantment id, one of the Native.Enchantment constants
Returns void
setCustomName
Sets item's custom name. Creates new ItemExtraData instance if it doesn't exist.
Parameters
name: string
Returns void
Class representing item stack in the inventory.