PocketMine-MP  1.4 - API 1.10.0
 All Classes Namespaces Functions Variables Pages
pocketmine\inventory\Inventory Interface Reference
+ Inheritance diagram for pocketmine\inventory\Inventory:
+ Collaboration diagram for pocketmine\inventory\Inventory:

Public Member Functions

 getSize ()
 
 getMaxStackSize ()
 
 setMaxStackSize ($size)
 
 getName ()
 
 getTitle ()
 
 getItem ($index)
 
 setItem ($index, Item $item, $source=null)
 
 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, $source=null)
 
 clearAll ()
 
 getViewers ($source=null)
 
 getType ()
 
 getHolder ()
 
 onOpen (Player $who)
 
 open (Player $who)
 
 close (Player $who)
 
 onClose (Player $who)
 
 onSlotChange ($index, $before, $source=null)
 

Public Attributes

const MAX_STACK = 64
 

Detailed Description

Definition at line 30 of file Inventory.php.

Member Function Documentation

pocketmine\inventory\Inventory::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. A Player source can be set at the end

Parameters
Item...$item
Returns
Item[]
pocketmine\inventory\Inventory::all ( Item  $item)

Will return all the Items that has the same id and metadata (if not null). Won't check amount

Parameters
Item$item
Returns
Item[]

Implemented in pocketmine\inventory\BaseInventory.

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

Checks if a given Item can be added to the inventory

Parameters
Item$item
Returns
bool

Implemented in pocketmine\inventory\BaseInventory.

pocketmine\inventory\Inventory::clear (   $index,
  $source = null 
)

Will clear a specific slot

Parameters
int$index
Player$source
Returns
bool

Implemented in pocketmine\inventory\BaseInventory, pocketmine\inventory\PlayerInventory, and pocketmine\inventory\DoubleChestInventory.

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

Parameters
Item$item
Returns
bool

Implemented in pocketmine\inventory\BaseInventory.

pocketmine\inventory\Inventory::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

Parameters
Item$item
Returns
int

Implemented in pocketmine\inventory\BaseInventory.

pocketmine\inventory\Inventory::firstEmpty ( )

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

Returns
int

Implemented in pocketmine\inventory\BaseInventory.

pocketmine\inventory\Inventory::getContents ( )
pocketmine\inventory\Inventory::getItem (   $index)
Parameters
int$index
Returns
Item

Implemented in pocketmine\inventory\BaseInventory, and pocketmine\inventory\DoubleChestInventory.

pocketmine\inventory\Inventory::getType ( )
pocketmine\inventory\Inventory::getViewers (   $source = null)

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

Parameters
Player$source
Returns
Player[]

Implemented in pocketmine\inventory\BaseInventory.

pocketmine\inventory\Inventory::onSlotChange (   $index,
  $before,
  $source = null 
)
pocketmine\inventory\Inventory::open ( Player  $who)

Tries to open the inventory to a player

Parameters
Player$who
Returns
bool

Implemented in pocketmine\inventory\BaseInventory.

Referenced by pocketmine\Player\addWindow().

+ Here is the caller graph for this function:

pocketmine\inventory\Inventory::remove ( Item  $item)

Will remove all the Items that has the same id and metadata (if not null)

Parameters
Item$item

Implemented in pocketmine\inventory\BaseInventory.

pocketmine\inventory\Inventory::removeItem (   $slots)

Removes the given Item from the inventory. It will return the Items that couldn't be removed. A Player source can be set at the end

Parameters
Item...$item
Returns
Item[]
pocketmine\inventory\Inventory::sendContents (   $target)
Parameters
Player|Player[]$target

Implemented in pocketmine\inventory\BaseInventory, and pocketmine\inventory\PlayerInventory.

pocketmine\inventory\Inventory::sendSlot (   $index,
  $target 
)
Parameters
int$index
Player|Player[]$target

Implemented in pocketmine\inventory\BaseInventory.

pocketmine\inventory\Inventory::setContents ( array  $items)
pocketmine\inventory\Inventory::setItem (   $index,
Item  $item,
  $source = null 
)

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

Parameters
int$index
Item$item
Player$source
Returns
bool

Implemented in pocketmine\inventory\PlayerInventory, pocketmine\inventory\BaseInventory, and pocketmine\inventory\DoubleChestInventory.

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

Implemented in pocketmine\inventory\BaseInventory.


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