PocketMine-MP 5.16.1 git-585aee9386a787c95e73dd0a05ffca8329606b68
Inventory.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
27namespace pocketmine\inventory;
28
32
33interface Inventory{
34 public const MAX_STACK = 64;
35
39 public function getSize() : int;
40
45 public function getMaxStackSize() : int;
46
50 public function setMaxStackSize(int $size) : void;
51
55 public function getItem(int $index) : Item;
56
60 public function setItem(int $index, Item $item) : void;
61
69 public function getContents(bool $includeEmpty = false) : array;
70
78 public function setContents(array $items) : void;
79
89 public function addItem(Item ...$slots) : array;
90
94 public function canAddItem(Item $item) : bool;
95
99 public function getAddableItemQuantity(Item $item) : int;
100
108 public function contains(Item $item) : bool;
109
120 public function all(Item $item) : array;
121
128 public function first(Item $item, bool $exact = false) : int;
129
133 public function firstEmpty() : int;
134
138 public function isSlotEmpty(int $index) : bool;
139
146 public function remove(Item $item) : void;
147
157 public function removeItem(Item ...$slots) : array;
158
162 public function clear(int $index) : void;
163
167 public function clearAll() : void;
168
172 public function swap(int $slot1, int $slot2) : void;
173
180 public function getViewers() : array;
181
185 public function onOpen(Player $who) : void;
186
187 public function onClose(Player $who) : void;
188
192 public function slotExists(int $slot) : bool;
193
198 public function getListeners() : ObjectSet;
199}
getContents(bool $includeEmpty=false)
setItem(int $index, Item $item)
first(Item $item, bool $exact=false)
swap(int $slot1, int $slot2)