PocketMine-MP 5.21.3 git-fcef015f32c0b0709cfd4d6f1b3c32f484b25bde
|
Public Member Functions | |
addItem (Item ... $slots) | |
all (Item $item) | |
canAddItem (Item $item) | |
clear (int $index) | |
clearAll () | |
contains (Item $item) | |
first (Item $item, bool $exact=false) | |
firstEmpty () | |
getAddableItemQuantity (Item $item) | |
getContents (bool $includeEmpty=false) | |
getItem (int $index) | |
getListeners () | |
getMaxStackSize () | |
getSize () | |
getViewers () | |
isSlotEmpty (int $index) | |
onClose (Player $who) | |
onOpen (Player $who) | |
remove (Item $item) | |
removeItem (Item ... $slots) | |
setContents (array $items) | |
setItem (int $index, Item $item) | |
setMaxStackSize (int $size) | |
slotExists (int $slot) | |
swap (int $slot1, int $slot2) | |
Public Attributes | |
const | MAX_STACK = 64 |
Definition at line 33 of file Inventory.php.
pocketmine\inventory\Inventory::addItem | ( | Item ... | $slots | ) |
Stores the given Items in the inventory. This will add to any non-full existing stacks first, and then put the remaining items in empty slots if there are any available.
Returns an array of items which could not fit in the inventory.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::all | ( | Item | $item | ) |
Returns all matching items in the inventory, irrespective of stack size. The returned array is indexed by slot number.
If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item type is checked.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::canAddItem | ( | Item | $item | ) |
Checks if a given Item can be added to the inventory
Implemented in pocketmine\block\inventory\ShulkerBoxInventory, and pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::clear | ( | int | $index | ) |
Will clear a specific slot
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::clearAll | ( | ) |
Clears all the slots
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::contains | ( | Item | $item | ) |
Returns whether the total amount of matching items is at least the stack size of the given item. Multiple stacks of the same item are added together.
If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item type is checked.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::first | ( | Item | $item, |
bool | $exact = false ) |
Returns the first slot number containing a matching item with a stack size greater than or equal to the input item.
If the input item has specific NBT, or if $exact is true, only items with the same type and NBT will match. Otherwise, only the item type is checked.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::firstEmpty | ( | ) |
Returns the first empty slot, or -1 if not found
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::getAddableItemQuantity | ( | Item | $item | ) |
Returns how many items from the given itemstack can be added to this inventory.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::getContents | ( | bool | $includeEmpty = false | ) |
Returns an array of all the itemstacks in the inventory, indexed by their slot number. Empty slots are not included unless includeEmpty is true.
Implemented in pocketmine\block\inventory\DoubleChestInventory, pocketmine\inventory\DelegateInventory, pocketmine\inventory\SimpleInventory, and pocketmine\inventory\transaction\TransactionBuilderInventory.
pocketmine\inventory\Inventory::getItem | ( | int | $index | ) |
Returns the item in the specified slot.
Implemented in pocketmine\block\inventory\DoubleChestInventory, pocketmine\inventory\DelegateInventory, pocketmine\inventory\SimpleInventory, and pocketmine\inventory\transaction\TransactionBuilderInventory.
pocketmine\inventory\Inventory::getListeners | ( | ) |
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::getMaxStackSize | ( | ) |
Returns the maximum stack size for items in this inventory. Individual item types (such as armor or tools) may have a smaller maximum stack size.
Implemented in pocketmine\block\inventory\CampfireInventory, and pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::getSize | ( | ) |
Returns the number of slots in the inventory.
Implemented in pocketmine\block\inventory\DoubleChestInventory, pocketmine\inventory\DelegateInventory, pocketmine\inventory\SimpleInventory, and pocketmine\inventory\transaction\TransactionBuilderInventory.
pocketmine\inventory\Inventory::getViewers | ( | ) |
Gets all the Players viewing the inventory Players will view their inventory at all times, even when not open.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::isSlotEmpty | ( | int | $index | ) |
Returns whether the given slot is empty.
Implemented in pocketmine\block\inventory\DoubleChestInventory, pocketmine\inventory\BaseInventory, pocketmine\inventory\DelegateInventory, and pocketmine\inventory\SimpleInventory.
pocketmine\inventory\Inventory::onOpen | ( | Player | $who | ) |
Called when a player opens this inventory.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::remove | ( | Item | $item | ) |
Clears all slots containing items equivalent to the given item.
If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item type is checked.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::removeItem | ( | Item ... | $slots | ) |
Removes items from the inventory in the amounts specified by the given itemstacks. Returns an array of items that couldn't be removed.
If the input item has specific NBT, only items with the same type and NBT will match. Otherwise, only the item type is checked.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::setContents | ( | array | $items | ) |
Sets the contents of the inventory. Non-numeric offsets or offsets larger than the size of the inventory are ignored.
Item[] | $items | @phpstan-param array<int, Item> $items |
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::setItem | ( | int | $index, |
Item | $item ) |
Puts an Item in a slot.
Implemented in pocketmine\crafting\CraftingGrid, and pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::setMaxStackSize | ( | int | $size | ) |
Sets the maximum stack size for items in this inventory.
Implemented in pocketmine\inventory\BaseInventory.
pocketmine\inventory\Inventory::slotExists | ( | int | $slot | ) |
Returns whether the specified slot exists in the inventory.
Implemented in pocketmine\inventory\BaseInventory.
Referenced by pocketmine\network\mcpe\InventoryManager\locateWindowAndSlot().
pocketmine\inventory\Inventory::swap | ( | int | $slot1, |
int | $slot2 ) |
Swaps the specified slots.
Implemented in pocketmine\inventory\BaseInventory.
const pocketmine\inventory\Inventory::MAX_STACK = 64 |
Definition at line 34 of file Inventory.php.