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

Public Member Functions

 onOpen (Player $who)
 
 onClose (Player $who)
 
 getSize ()
 
 getMaxStackSize ()
 
 getName ()
 
 getTitle ()
 
 getItem ($index)
 
 getContents ()
 
 setContents (array $items)
 
 setItem ($index, Item $item, $source=null)
 
 contains (Item $item)
 
 all (Item $item)
 
 remove (Item $item)
 
 first (Item $item)
 
 firstEmpty ()
 
 canAddItem (Item $item)
 
 clear ($index, $source=null)
 
 clearAll ()
 
 getViewers ($source=null)
 
 getHolder ()
 
 setMaxStackSize ($size)
 
 open (Player $who)
 
 close (Player $who)
 
 onSlotChange ($index, $before, $source=null)
 
 sendContents ($target)
 
 sendSlot ($index, $target)
 
 getType ()
 
 addItem (...$slots)
 
 removeItem (...$slots)
 

Public Attributes

const MAX_STACK = 64
 

Protected Attributes

 $type
 
 $maxStackSize = Inventory::MAX_STACK
 
 $size
 
 $name
 
 $title
 
 $slots = []
 
 $viewers = []
 
 $holder
 

Detailed Description

All plugins that want to create their custom inventory should use this class as a base

Definition at line 27 of file CustomInventory.php.

Member Function Documentation

pocketmine\inventory\Inventory::addItem (   $slots)
inherited

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\BaseInventory::all ( Item  $item)
inherited

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

Parameters
Item$item
Returns
Item[]

Implements pocketmine\inventory\Inventory.

Definition at line 163 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getContents().

+ Here is the call graph for this function:

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

Checks if a given Item can be added to the inventory

Parameters
Item$item
Returns
bool

Implements pocketmine\inventory\Inventory.

Definition at line 206 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getItem().

+ Here is the call graph for this function:

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

Will clear a specific slot

Parameters
int$index
Player$source
Returns
bool

Implements pocketmine\inventory\Inventory.

Definition at line 335 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getHolder(), pocketmine\Server\getInstance(), pocketmine\inventory\BaseInventory\getViewers(), pocketmine\inventory\BaseInventory\onSlotChange(), and pocketmine\inventory\BaseInventory\sendSlot().

Referenced by pocketmine\inventory\BaseInventory\clearAll(), pocketmine\inventory\BaseInventory\remove(), pocketmine\inventory\BaseInventory\setContents(), and pocketmine\inventory\BaseInventory\setItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\BaseInventory::clearAll ( )
inherited

Clears all the slots

Implements pocketmine\inventory\Inventory.

Definition at line 360 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\clear(), and pocketmine\inventory\BaseInventory\getContents().

+ Here is the call graph for this function:

pocketmine\inventory\BaseInventory::contains ( Item  $item)
inherited

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

Implements pocketmine\inventory\Inventory.

Definition at line 148 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getContents().

+ Here is the call graph for this function:

pocketmine\inventory\BaseInventory::first ( Item  $item)
inherited

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

Implements pocketmine\inventory\Inventory.

Definition at line 184 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getContents().

+ Here is the call graph for this function:

pocketmine\inventory\BaseInventory::firstEmpty ( )
inherited

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

Returns
int

Implements pocketmine\inventory\Inventory.

Definition at line 196 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getItem().

+ Here is the call graph for this function:

pocketmine\inventory\BaseInventory::getContents ( )
inherited
Returns
Item[]

Implements pocketmine\inventory\Inventory.

Definition at line 100 of file BaseInventory.php.

Referenced by pocketmine\inventory\BaseInventory\all(), pocketmine\inventory\BaseInventory\clearAll(), pocketmine\inventory\BaseInventory\contains(), pocketmine\inventory\BaseInventory\first(), and pocketmine\inventory\BaseInventory\remove().

+ Here is the caller graph for this function:

pocketmine\inventory\BaseInventory::getHolder ( )
inherited
Returns
InventoryHolder

Implements pocketmine\inventory\Inventory.

Definition at line 383 of file BaseInventory.php.

Referenced by pocketmine\inventory\BaseInventory\clear(), pocketmine\inventory\ContainerInventory\onOpen(), and pocketmine\inventory\BaseInventory\setItem().

+ Here is the caller graph for this function:

pocketmine\inventory\BaseInventory::getType ( )
inherited
Returns
InventoryType

Implements pocketmine\inventory\Inventory.

Definition at line 465 of file BaseInventory.php.

Referenced by pocketmine\inventory\ContainerInventory\onOpen().

+ Here is the caller graph for this function:

pocketmine\inventory\ContainerInventory::onClose ( Player  $who)
inherited
Parameters
Player$who

Implements pocketmine\inventory\Inventory.

Definition at line 50 of file ContainerInventory.php.

References pocketmine\Player\dataPacket(), and pocketmine\Player\getWindowId().

+ Here is the call graph for this function:

pocketmine\inventory\ContainerInventory::onOpen ( Player  $who)
inherited
Parameters
Player$who

Implements pocketmine\inventory\Inventory.

Definition at line 30 of file ContainerInventory.php.

References pocketmine\Player\dataPacket(), pocketmine\inventory\BaseInventory\getHolder(), pocketmine\inventory\BaseInventory\getType(), pocketmine\Player\getWindowId(), and pocketmine\inventory\BaseInventory\sendContents().

+ Here is the call graph for this function:

pocketmine\inventory\BaseInventory::onSlotChange (   $index,
  $before,
  $source = null 
)
inherited
Parameters
int$index
Item$before
Player$source

Implements pocketmine\inventory\Inventory.

Definition at line 413 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getViewers(), and pocketmine\inventory\BaseInventory\sendSlot().

Referenced by pocketmine\inventory\BaseInventory\clear(), and pocketmine\inventory\BaseInventory\setItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\BaseInventory::open ( Player  $who)
inherited

Tries to open the inventory to a player

Parameters
Player$who
Returns
bool

Implements pocketmine\inventory\Inventory.

Definition at line 391 of file BaseInventory.php.

References pocketmine\Player\getServer(), and pocketmine\inventory\BaseInventory\onOpen().

+ Here is the call graph for this function:

pocketmine\inventory\BaseInventory::remove ( Item  $item)
inherited

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

Parameters
Item$item

Implements pocketmine\inventory\Inventory.

Definition at line 175 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\clear(), and pocketmine\inventory\BaseInventory\getContents().

+ Here is the call graph for this function:

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

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\BaseInventory::sendContents (   $target)
inherited
Parameters
Player|Player[]$target

Implements pocketmine\inventory\Inventory.

Definition at line 421 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getItem().

Referenced by pocketmine\inventory\ContainerInventory\onOpen().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Implements pocketmine\inventory\Inventory.

Definition at line 446 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\getItem().

Referenced by pocketmine\inventory\PlayerInventory\clear(), pocketmine\inventory\BaseInventory\clear(), pocketmine\inventory\BaseInventory\onSlotChange(), pocketmine\inventory\BaseInventory\setItem(), and pocketmine\inventory\PlayerInventory\setItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\BaseInventory::setContents ( array  $items)
inherited
Parameters
Item[]$items

Implements pocketmine\inventory\Inventory.

Definition at line 107 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\clear(), and pocketmine\inventory\BaseInventory\setItem().

Referenced by pocketmine\inventory\BaseInventory\__construct().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\BaseInventory::setItem (   $index,
Item  $item,
  $source = null 
)
inherited

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

Implements pocketmine\inventory\Inventory.

Definition at line 123 of file BaseInventory.php.

References pocketmine\inventory\BaseInventory\clear(), pocketmine\inventory\BaseInventory\getHolder(), pocketmine\Server\getInstance(), pocketmine\inventory\BaseInventory\getItem(), pocketmine\inventory\BaseInventory\getViewers(), pocketmine\inventory\BaseInventory\onSlotChange(), and pocketmine\inventory\BaseInventory\sendSlot().

Referenced by pocketmine\inventory\BaseInventory\setContents(), pocketmine\inventory\FurnaceInventory\setFuel(), pocketmine\inventory\FurnaceInventory\setResult(), and pocketmine\inventory\FurnaceInventory\setSmelting().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\BaseInventory::setMaxStackSize (   $size)
inherited
Parameters
int$size

Implements pocketmine\inventory\Inventory.

Definition at line 387 of file BaseInventory.php.


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