|
PocketMine
|
Public Member Functions | |
| getSize () | |
| getMaxStackSize () | |
| setMaxStackSize ($size) | |
| getName () | |
| getTitle () | |
| getItem ($index) | |
| setItem ($index, Item $item) | |
| addItem (...$slots) | |
| canAddItem (Item $item) | |
| removeItem (...$slots) | |
| getContents () | |
| setContents (array $items) | |
| sendContents ($target) | |
| sendSlot ($index, $target) | |
| contains (Item $item) | |
| all (Item $item) | |
| first (Item $item) | |
| firstEmpty () | |
| remove (Item $item) | |
| clear ($index) | |
| clearAll () | |
| getViewers () | |
| getType () | |
| getHolder () | |
| onOpen (Player $who) | |
| open (Player $who) | |
| close (Player $who) | |
| onClose (Player $who) | |
| onSlotChange ($index, $before) | |
Data Fields | |
| const | MAX_STACK = 64 |
| addItem | ( | $slots | ) |
Stores the given Items in the inventory. This will try to fill existing stacks and empty slots as well as it can.
Returns the Items that did not fit.
| Item | ...$item |
| all | ( | Item | $item | ) |
Will return all the Items that has the same id and metadata (if not null). Won't check amount
| Item | $item |
Implemented in BaseInventory.
| canAddItem | ( | Item | $item | ) |
Checks if a given Item can be added to the inventory
| Item | $item |
Implemented in BaseInventory.
| clear | ( | $index | ) |
Will clear a specific slot
| int | $index |
Implemented in BaseInventory, PlayerInventory, and DoubleChestInventory.
| clearAll | ( | ) |
Clears all the slots
Implemented in BaseInventory, and PlayerInventory.
| contains | ( | Item | $item | ) |
Checks if the inventory contains any Item with the same material data. It will check id, amount, and metadata (if not null)
| Item | $item |
Implemented in BaseInventory.
| first | ( | Item | $item | ) |
Will return the first slot has the same id and metadata (if not null) as the Item. -1 if not found, will check amount
| Item | $item |
Implemented in BaseInventory.
| firstEmpty | ( | ) |
| getContents | ( | ) |
Implemented in BaseInventory, and DoubleChestInventory.
| getHolder | ( | ) |
Implemented in PlayerInventory, BaseInventory, DoubleChestInventory, ChestInventory, FurnaceInventory, AnvilInventory, and EnchantInventory.
| getItem | ( | $index | ) |
| getType | ( | ) |
Implemented in BaseInventory.
| getViewers | ( | ) |
Gets all the Players viewing the inventory Players will view their inventory at all times, even when not open.
Implemented in BaseInventory.
| onClose | ( | Player | $who | ) |
| Player | $who |
Implemented in BaseInventory, DoubleChestInventory, ChestInventory, ContainerInventory, AnvilInventory, and EnchantInventory.
| onOpen | ( | Player | $who | ) |
| Player | $who |
Implemented in BaseInventory, DoubleChestInventory, ChestInventory, and ContainerInventory.
| onSlotChange | ( | $index, | |
| $before | |||
| ) |
| int | $index | |
| Item | $before |
Implemented in BaseInventory, PlayerInventory, and FurnaceInventory.
| open | ( | Player | $who | ) |
Tries to open the inventory to a player
| Player | $who |
Implemented in BaseInventory.
| remove | ( | Item | $item | ) |
Will remove all the Items that has the same id and metadata (if not null)
| Item | $item |
Implemented in BaseInventory.
| removeItem | ( | $slots | ) |
Removes the given Item from the inventory. It will return the Items that couldn't be removed.
| Item | ...$item |
| sendContents | ( | $target | ) |
| Player|Player[] | $target |
Implemented in BaseInventory, and PlayerInventory.
| sendSlot | ( | $index, | |
| $target | |||
| ) |
| int | $index | |
| Player|Player[] | $target |
Implemented in BaseInventory.
| setContents | ( | array | $items | ) |
| Item[] | $items |
Implemented in BaseInventory, and DoubleChestInventory.
| setItem | ( | $index, | |
| Item | $item | ||
| ) |
Puts an Item in a slot. If a plugin refuses the update or $index is invalid, it'll return false If a source Player is specified, it won't send a Inventory update to it
| int | $index | |
| Item | $item |
Implemented in PlayerInventory, BaseInventory, and DoubleChestInventory.
| setMaxStackSize | ( | $size | ) |
| int | $size |
Implemented in BaseInventory.