ISlot
Represents an instance of a slot.
Note: A lot of inventory functions usually have a bool to indicate the tasks success or failure, as the server can reject these actions.
Methods | Properties |
HasNbt | Id |
GetName | Count |
GetLore | Damage (aka. metadata) |
HasEnchantment |
|
GetEnchantmentLevel | |
GetEnchantments | |
| |
IsEmpty | |
IsStackFull | |
IsStackable | |
DropStack | |
Drop | |
Eat | |
Select | |
Use | |
Transfer | |
DepositTo | |
BringToHotbar | |
IsWearable | |
PutOn | |
TakeOff |
Methods
HasNbt
Returns true if the slot has NBT data, otherwise false. NBT data can store such information as enchantments, the title (custom name) of the item, etc. You do not have to access the NBT variable manually, instead functions like GetName(), HasEnchantment(), etc should be used instead.
GetName
Returns the title (custom name) of the item. Can be null if there is no NBT data and the item was not renamed by the server/anvil.
GetLore
Returns the lore (description) of the item from the NBT data, if there is no NBT data then null is returned.
HasEnchantment
Returns true if the Item has an enchantment with a given id, otherwise false. You can find the enchantment id list here.
GetEnchantmentLevel
Returns the enchantment level on this item by enchantment id. You can find the enchantment id list here. Note: returns -1 if the item does not have an enchantment with the specified id.
GetEnchantments
Returns an array of all enchantments on the item. The enchantment class contains the id and level of the enchantment.
GetNBT (legacy)
Returns a string representation of the NBT data.
IsEmpty
Returns true if the slot is empty (non-occupied), otherwise false.
IsStackFull
Returns true if the item stack is full, otherwise false.
IsStackable
Returns true if the item is stackable, otherwise false.
DropStack
Attempts to drop the entire stack, returns true if this was successful, otherwise false.
Drop
Attempts to drop a single item (1 out of 64) from the item stack. Returns true if successful, otherwise false.
Eat
Attempts to eat the Item. Returns true if successful, otherwise false.
Select
Attempts to select (bring to to hotbar and select) the item from this slot. Returns true if successful, otherwise false.
Use
Attempts to use (bring to hotbar, select, and right click it) the item from this slot. Returns true if successful, otherwise false.
Transfer
Attempts to transfer the item to another slot. Returns true if successful, otherwise false.
DepositTo
Attempts to deposit an item to the specified window. Returns true if successful, otherwise false. You can optionally specify a specific slot index that the item should be placed at using the index parameter. If the index is not specified then it will place the item in the first available slot.
BringToHotbar
Attempts to bring the item to the hotbar. Returns true if successful, otherwise false. You can optionally specify a hotbar slot index (0-8). If the slot index is not specified then it will place it in the first available slot or the currently selected slot.
IsWearable
Returns true if the item is wearable (e.g.: armor).
PutOn
Attempts to put on (equip) the item. Returns true if successful, otherwise false.
TakeOff
Attempts to take off (unequip) the item. Returns true if successful, otherwise false.
Last updated