*/ public function getContents(bool $includeEmpty = false) : array; /** * Sets the contents of the inventory. Non-numeric offsets or offsets larger than the size of the inventory are * ignored. * * @param Item[] $items * @phpstan-param array $items */ public function setContents(array $items) : void; /** * 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. * * @return Item[] */ public function addItem(Item ...$slots) : array; /** * Checks if a given Item can be added to the inventory */ public function canAddItem(Item $item) : bool; /** * Returns how many items from the given itemstack can be added to this inventory. */ public function getAddableItemQuantity(Item $item) : int; /** * 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. */ public function contains(Item $item) : bool; /** * 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. * * @return Item[] * @phpstan-return array */ public function all(Item $item) : array; /** * 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. */ public function first(Item $item, bool $exact = false) : int; /** * Returns the first empty slot, or -1 if not found */ public function firstEmpty() : int; /** * Returns whether the given slot is empty. */ public function isSlotEmpty(int $index) : bool; /** * 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. */ public function remove(Item $item) : void; /** * 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. * * @return Item[] */ public function removeItem(Item ...$slots) : array; /** * Will clear a specific slot */ public function clear(int $index) : void; /** * Clears all the slots */ public function clearAll() : void; /** * Swaps the specified slots. */ public function swap(int $slot1, int $slot2) : void; /** * Gets all the Players viewing the inventory * Players will view their inventory at all times, even when not open. * * @return Player[] */ public function getViewers() : array; /** * Called when a player opens this inventory. */ public function onOpen(Player $who) : void; public function onClose(Player $who) : void; /** * Returns whether the specified slot exists in the inventory. */ public function slotExists(int $slot) : bool; /** * @return InventoryListener[]|ObjectSet * @phpstan-return ObjectSet */ public function getListeners() : ObjectSet; }