Inventory
endstone.inventory
¶
Classes:
Name | Description |
---|---|
Inventory |
Interface to the various inventories. |
ItemMeta |
Represents the metadata of a generic item. |
ItemStack |
Represents a stack of items. |
MapMeta |
Represents the metadata for a map item. |
PlayerInventory |
Interface to the inventory of a Player, including the four armor slots and any extra slots. |
Inventory
¶
Interface to the various inventories.
Methods:
Name | Description |
---|---|
add_item |
Stores the given ItemStacks in the inventory. This will try to fill existing stacks and empty slots as well as it can. |
clear |
Clears out the whole Inventory. |
first |
Returns the first slot in the inventory containing an ItemStack with the given stack. |
get_item |
Returns the ItemStack found in the slot at the given index |
set_item |
Stores the ItemStack at the given index of the inventory. |
Attributes:
Name | Type | Description |
---|---|---|
contents |
list[ItemStack]
|
Returns all ItemStacks from the inventory |
is_empty |
bool
|
Check whether this inventory is empty. An inventory is considered to be empty if there are no ItemStacks in any slot of this inventory. |
max_stack_size |
int
|
Returns the maximum stack size for an ItemStack in this inventory. |
size |
int
|
Returns the size of the inventory |
is_empty
property
¶
is_empty: bool
Check whether this inventory is empty. An inventory is considered to be empty if there are no ItemStacks in any slot of this inventory.
max_stack_size
property
¶
max_stack_size: int
Returns the maximum stack size for an ItemStack in this inventory.
add_item
¶
add_item(item: ItemStack) -> None
Stores the given ItemStacks in the inventory. This will try to fill existing stacks and empty slots as well as it can.
first
¶
Returns the first slot in the inventory containing an ItemStack with the given stack.
get_item
¶
Returns the ItemStack found in the slot at the given index
ItemMeta
¶
Represents the metadata of a generic item.
Methods:
Name | Description |
---|---|
clone |
Creates a clone of the current metadata. |
Attributes:
Name | Type | Description |
---|---|---|
damage |
int
|
Gets or sets the damage. |
display_name |
str | None
|
Gets or sets the display name. |
has_damage |
bool
|
Checks to see if this item has damage |
has_display_name |
bool
|
Checks for existence of a display name. |
has_lore |
bool
|
Checks for existence of lore. |
lore |
list[str] | None
|
Gets or sets the lore for this item. |
ItemStack
¶
Represents a stack of items.
Methods:
Name | Description |
---|---|
set_item_meta |
Set the ItemMeta of this ItemStack. |
Attributes:
Name | Type | Description |
---|---|---|
amount |
int
|
Gets or sets the amount of items in this stack. |
item_meta |
ItemMeta
|
Gets a copy of the ItemMeta of this ItemStack. |
type |
str
|
Gets or sets the type of this item. |
PlayerInventory
¶
Bases: Inventory
Interface to the inventory of a Player, including the four armor slots and any extra slots.
Attributes:
Name | Type | Description |
---|---|---|
boots |
ItemStack
|
Gets or sets the ItemStack in the boots slot |
chestplate |
ItemStack
|
Gets or sets the ItemStack in the chestplate slot |
held_item_slot |
int
|
Gets or sets the slot number of the currently held item |
helmet |
ItemStack
|
Gets or sets the ItemStack in the helmet slot |
item_in_main_hand |
ItemStack
|
Gets or sets the item the player is currently holding in their main hand. |
item_in_off_hand |
ItemStack
|
Gets or sets the item the player is currently holding in their off hand. |
leggings |
ItemStack
|
Gets or sets the ItemStack in the leg slot |
chestplate
property
writable
¶
chestplate: ItemStack
Gets or sets the ItemStack in the chestplate slot
held_item_slot
property
writable
¶
held_item_slot: int
Gets or sets the slot number of the currently held item
item_in_main_hand
property
writable
¶
item_in_main_hand: ItemStack
Gets or sets the item the player is currently holding in their main hand.