PocketMine-MP 5.15.1 git-be6754494fdbbb9dd57c058ba0e33a4a78c4581f
pocketmine\inventory\TemporaryInventory Interface Reference
+ Inheritance diagram for pocketmine\inventory\TemporaryInventory:
+ Collaboration diagram for pocketmine\inventory\TemporaryInventory:

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
 

Detailed Description

Definition at line 26 of file TemporaryInventory.php.

Member Function Documentation

◆ addItem()

pocketmine\inventory\Inventory::addItem ( Item ...  $slots)
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.

Returns
Item[]

Implemented in pocketmine\inventory\BaseInventory.

◆ all()

pocketmine\inventory\Inventory::all ( Item  $item)
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.

Returns
Item[] @phpstan-return array<int, Item>

Implemented in pocketmine\inventory\BaseInventory.

◆ canAddItem()

pocketmine\inventory\Inventory::canAddItem ( Item  $item)
inherited

Checks if a given Item can be added to the inventory

Implemented in pocketmine\block\inventory\ShulkerBoxInventory, and pocketmine\inventory\BaseInventory.

◆ clear()

pocketmine\inventory\Inventory::clear ( int  $index)
inherited

Will clear a specific slot

Implemented in pocketmine\inventory\BaseInventory.

◆ clearAll()

pocketmine\inventory\Inventory::clearAll ( )
inherited

Clears all the slots

Implemented in pocketmine\inventory\BaseInventory.

◆ contains()

pocketmine\inventory\Inventory::contains ( Item  $item)
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.

Implemented in pocketmine\inventory\BaseInventory.

◆ first()

pocketmine\inventory\Inventory::first ( Item  $item,
bool  $exact = false 
)
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.

Implemented in pocketmine\inventory\BaseInventory.

◆ firstEmpty()

pocketmine\inventory\Inventory::firstEmpty ( )
inherited

Returns the first empty slot, or -1 if not found

Implemented in pocketmine\inventory\BaseInventory.

◆ getAddableItemQuantity()

pocketmine\inventory\Inventory::getAddableItemQuantity ( Item  $item)
inherited

Returns how many items from the given itemstack can be added to this inventory.

Implemented in pocketmine\inventory\BaseInventory.

◆ getContents()

pocketmine\inventory\Inventory::getContents ( bool  $includeEmpty = false)
inherited

Returns an array of all the itemstacks in the inventory, indexed by their slot number. Empty slots are not included unless includeEmpty is true.

Returns
Item[] @phpstan-return array<int, Item>

Implemented in pocketmine\block\inventory\DoubleChestInventory, pocketmine\inventory\DelegateInventory, pocketmine\inventory\SimpleInventory, and pocketmine\inventory\transaction\TransactionBuilderInventory.

◆ getItem()

pocketmine\inventory\Inventory::getItem ( int  $index)
inherited

◆ getListeners()

pocketmine\inventory\Inventory::getListeners ( )
inherited
Returns
InventoryListener[]|ObjectSet @phpstan-return ObjectSet<InventoryListener>

Implemented in pocketmine\inventory\BaseInventory.

◆ getMaxStackSize()

pocketmine\inventory\Inventory::getMaxStackSize ( )
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.

Implemented in pocketmine\inventory\BaseInventory.

◆ getSize()

pocketmine\inventory\Inventory::getSize ( )
inherited

◆ getViewers()

pocketmine\inventory\Inventory::getViewers ( )
inherited

Gets all the Players viewing the inventory Players will view their inventory at all times, even when not open.

Returns
Player[]

Implemented in pocketmine\inventory\BaseInventory.

◆ isSlotEmpty()

pocketmine\inventory\Inventory::isSlotEmpty ( int  $index)
inherited

◆ onOpen()

pocketmine\inventory\Inventory::onOpen ( Player  $who)
inherited

Called when a player opens this inventory.

Implemented in pocketmine\inventory\BaseInventory.

◆ remove()

pocketmine\inventory\Inventory::remove ( Item  $item)
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.

Implemented in pocketmine\inventory\BaseInventory.

◆ removeItem()

pocketmine\inventory\Inventory::removeItem ( Item ...  $slots)
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.

Returns
Item[]

Implemented in pocketmine\inventory\BaseInventory.

◆ setContents()

pocketmine\inventory\Inventory::setContents ( array  $items)
inherited

Sets the contents of the inventory. Non-numeric offsets or offsets larger than the size of the inventory are ignored.

Parameters
Item[]$items@phpstan-param array<int, Item> $items

Implemented in pocketmine\inventory\BaseInventory.

◆ setItem()

pocketmine\inventory\Inventory::setItem ( int  $index,
Item  $item 
)
inherited

Puts an Item in a slot.

Implemented in pocketmine\crafting\CraftingGrid, and pocketmine\inventory\BaseInventory.

◆ setMaxStackSize()

pocketmine\inventory\Inventory::setMaxStackSize ( int  $size)
inherited

Sets the maximum stack size for items in this inventory.

Implemented in pocketmine\inventory\BaseInventory.

◆ slotExists()

pocketmine\inventory\Inventory::slotExists ( int  $slot)
inherited

Returns whether the specified slot exists in the inventory.

Implemented in pocketmine\inventory\BaseInventory.

Referenced by pocketmine\network\mcpe\InventoryManager\locateWindowAndSlot().

+ Here is the caller graph for this function:

◆ swap()

pocketmine\inventory\Inventory::swap ( int  $slot1,
int  $slot2 
)
inherited

Swaps the specified slots.

Implemented in pocketmine\inventory\BaseInventory.

Member Data Documentation

◆ MAX_STACK

const pocketmine\inventory\Inventory::MAX_STACK = 64
inherited

Definition at line 34 of file Inventory.php.


The documentation for this interface was generated from the following file: