PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
|
Public Member Functions | |
__construct (Human $player) | |
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) | |
getHeldItemIndex () | |
getHeldItemIndexChangeListeners () | |
getHolder () | |
getHotbarSize () | |
getHotbarSlotItem (int $hotbarSlot) | |
getItem (int $index) | |
getItemInHand () | |
getListeners () | |
getMaxStackSize () | |
getSize () | |
getSlotValidators () | |
getViewers () | |
isHotbarSlot (int $slot) | |
isSlotEmpty (int $index) | |
onClose (Player $who) | |
onOpen (Player $who) | |
remove (Item $item) | |
removeAllViewers () | |
removeItem (Item ... $slots) | |
setContents (array $items) | |
setHeldItemIndex (int $hotbarSlot) | |
setItem (int $index, Item $item) | |
setItemInHand (Item $item) | |
setMaxStackSize (int $size) | |
slotExists (int $slot) | |
swap (int $slot1, int $slot2) | |
Public Attributes | |
const | MAX_STACK = 64 |
Protected Member Functions | |
getMatchingItemCount (int $slot, Item $test, bool $checkTags) | |
internalSetContents (array $items) | |
internalSetItem (int $index, Item $item) | |
onContentChange (array $itemsBefore) | |
onSlotChange (int $index, Item $before) | |
Protected Attributes | |
ObjectSet | $heldItemIndexChangeListeners |
Human | $holder |
int | $itemInHandIndex = 0 |
ObjectSet | $listeners |
int | $maxStackSize = Inventory::MAX_STACK |
SplFixedArray | $slots |
ObjectSet | $validators |
array | $viewers = [] |
Definition at line 31 of file PlayerInventory.php.
pocketmine\inventory\PlayerInventory::__construct | ( | Human | $player | ) |
Definition at line 42 of file PlayerInventory.php.
|
inherited |
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.
Implements pocketmine\inventory\Inventory.
Definition at line 210 of file BaseInventory.php.
|
inherited |
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.
Implements pocketmine\inventory\Inventory.
Definition at line 140 of file BaseInventory.php.
|
inherited |
Checks if a given Item can be added to the inventory
Implements pocketmine\inventory\Inventory.
Reimplemented in pocketmine\block\inventory\ShulkerBoxInventory.
Definition at line 184 of file BaseInventory.php.
|
inherited |
Will clear a specific slot
Implements pocketmine\inventory\Inventory.
Definition at line 326 of file BaseInventory.php.
Referenced by pocketmine\inventory\transaction\TransactionBuilderInventory\internalSetContents().
|
inherited |
Clears all the slots
Implements pocketmine\inventory\Inventory.
Definition at line 330 of file BaseInventory.php.
|
inherited |
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.
Implements pocketmine\inventory\Inventory.
Definition at line 124 of file BaseInventory.php.
|
inherited |
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.
Implements pocketmine\inventory\Inventory.
Definition at line 152 of file BaseInventory.php.
|
inherited |
Returns the first empty slot, or -1 if not found
Implements pocketmine\inventory\Inventory.
Definition at line 166 of file BaseInventory.php.
|
inherited |
Returns how many items from the given itemstack can be added to this inventory.
Implements pocketmine\inventory\Inventory.
Definition at line 188 of file BaseInventory.php.
|
inherited |
Implements pocketmine\inventory\Inventory.
Definition at line 63 of file SimpleInventory.php.
pocketmine\inventory\PlayerInventory::getHeldItemIndex | ( | ) |
Returns the hotbar slot number the holder is currently holding.
Definition at line 74 of file PlayerInventory.php.
pocketmine\inventory\PlayerInventory::getHeldItemIndexChangeListeners | ( | ) |
Definition at line 100 of file PlayerInventory.php.
pocketmine\inventory\PlayerInventory::getHolder | ( | ) |
Definition at line 123 of file PlayerInventory.php.
pocketmine\inventory\PlayerInventory::getHotbarSize | ( | ) |
Returns the number of slots in the hotbar.
Definition at line 119 of file PlayerInventory.php.
pocketmine\inventory\PlayerInventory::getHotbarSlotItem | ( | int | $hotbarSlot | ) |
Returns the item in the specified hotbar slot.
InvalidArgumentException if the hotbar slot index is out of range
Definition at line 66 of file PlayerInventory.php.
|
inherited |
Returns the item in the specified slot.
Implements pocketmine\inventory\Inventory.
Definition at line 51 of file SimpleInventory.php.
pocketmine\inventory\PlayerInventory::getItemInHand | ( | ) |
Returns the currently-held item.
Definition at line 105 of file PlayerInventory.php.
|
inherited |
Implements pocketmine\inventory\Inventory.
Definition at line 403 of file BaseInventory.php.
|
protectedinherited |
Helper for utility functions which search the inventory. TODO: make this abstract instead of providing a slow default implementation (BC break)
Reimplemented from pocketmine\inventory\BaseInventory.
Definition at line 87 of file SimpleInventory.php.
|
inherited |
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.
Implements pocketmine\inventory\Inventory.
Reimplemented in pocketmine\block\inventory\CampfireInventory.
Definition at line 59 of file BaseInventory.php.
|
inherited |
Returns the size of the inventory.
Implements pocketmine\inventory\Inventory.
Definition at line 47 of file SimpleInventory.php.
|
inherited |
Returns a set of validators that will be used to determine whether an item can be placed in a particular slot. All validators need to return null for the transaction to be allowed. If one of the validators returns an exception, the transaction will be cancelled.
There is no guarantee that the validators will be called in any particular order.
@phpstan-return SlotValidators
Implements pocketmine\inventory\SlotValidatedInventory.
Definition at line 407 of file BaseInventory.php.
|
inherited |
Implements pocketmine\inventory\Inventory.
Definition at line 344 of file BaseInventory.php.
|
protectedinherited |
Item[] | $items | @phpstan-param array<int, Item> $items |
Reimplemented from pocketmine\inventory\BaseInventory.
Definition at line 77 of file SimpleInventory.php.
|
protectedinherited |
Reimplemented from pocketmine\inventory\BaseInventory.
Definition at line 55 of file SimpleInventory.php.
pocketmine\inventory\PlayerInventory::isHotbarSlot | ( | int | $slot | ) |
Definition at line 48 of file PlayerInventory.php.
|
inherited |
TODO: make this abstract and force implementations to implement it properly (BC break) This default implementation works, but is slow.
Reimplemented from pocketmine\inventory\BaseInventory.
Definition at line 92 of file SimpleInventory.php.
|
inherited |
Implements pocketmine\inventory\Inventory.
Definition at line 364 of file BaseInventory.php.
|
protectedinherited |
Item[] | $itemsBefore | @phpstan-param array<int, Item> $itemsBefore |
Reimplemented in pocketmine\inventory\DelegateInventory.
Definition at line 385 of file BaseInventory.php.
|
inherited |
Called when a player opens this inventory.
Implements pocketmine\inventory\Inventory.
Definition at line 360 of file BaseInventory.php.
|
protectedinherited |
Definition at line 368 of file BaseInventory.php.
|
inherited |
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.
Implements pocketmine\inventory\Inventory.
Definition at line 278 of file BaseInventory.php.
|
inherited |
Removes the inventory window from all players currently viewing it.
Definition at line 351 of file BaseInventory.php.
|
inherited |
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.
Implements pocketmine\inventory\Inventory.
Definition at line 288 of file BaseInventory.php.
|
inherited |
Item[] | $items | @phpstan-param array<int, Item> $items |
Implements pocketmine\inventory\Inventory.
Definition at line 92 of file BaseInventory.php.
pocketmine\inventory\PlayerInventory::setHeldItemIndex | ( | int | $hotbarSlot | ) |
Sets which hotbar slot the player is currently loading.
int | $hotbarSlot | 0-8 index of the hotbar slot to hold |
InvalidArgumentException if the hotbar slot is out of range
Definition at line 85 of file PlayerInventory.php.
|
inherited |
Puts an Item in a slot.
Implements pocketmine\inventory\Inventory.
Reimplemented in pocketmine\crafting\CraftingGrid.
Definition at line 69 of file BaseInventory.php.
Referenced by pocketmine\inventory\transaction\TransactionBuilderInventory\internalSetContents().
pocketmine\inventory\PlayerInventory::setItemInHand | ( | Item | $item | ) |
Sets the item in the currently-held slot to the specified item.
Definition at line 112 of file PlayerInventory.php.
|
inherited |
Sets the maximum stack size for items in this inventory.
Implements pocketmine\inventory\Inventory.
Definition at line 63 of file BaseInventory.php.
|
inherited |
Returns whether the specified slot exists in the inventory.
Implements pocketmine\inventory\Inventory.
Definition at line 399 of file BaseInventory.php.
|
inherited |
Swaps the specified slots.
Implements pocketmine\inventory\Inventory.
Definition at line 334 of file BaseInventory.php.
|
protected |
Definition at line 40 of file PlayerInventory.php.
|
protected |
Definition at line 33 of file PlayerInventory.php.
|
protected |
Definition at line 34 of file PlayerInventory.php.
|
protectedinherited |
Definition at line 50 of file BaseInventory.php.
|
protectedinherited |
Definition at line 43 of file BaseInventory.php.
|
protectedinherited |
Definition at line 37 of file SimpleInventory.php.
|
protectedinherited |
@phpstan-var SlotValidators
Definition at line 52 of file BaseInventory.php.
|
protectedinherited |
Definition at line 45 of file BaseInventory.php.
|
inherited |
Definition at line 34 of file Inventory.php.