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

Public Member Functions

 __construct (Human $player)
 
 getSize ()
 
 getHotbarSlotIndex ($index)
 
 setHotbarSlotIndex ($index, $slot)
 
 getHeldItemIndex ()
 
 setHeldItemIndex ($index)
 
 getItemInHand ()
 
 setItemInHand (Item $item, $source=null)
 
 getHeldItemSlot ()
 
 setHeldItemSlot ($slot)
 
 sendHeldItem ($target)
 
 onSlotChange ($index, $before, $source=null)
 
 getHotbarSize ()
 
 getArmorItem ($index)
 
 setArmorItem ($index, Item $item, $source=null)
 
 getHelmet ()
 
 getChestplate ()
 
 getLeggings ()
 
 getBoots ()
 
 setHelmet (Item $helmet)
 
 setChestplate (Item $chestplate)
 
 setLeggings (Item $leggings)
 
 setBoots (Item $boots)
 
 setItem ($index, Item $item, $source=null)
 
 clear ($index, $source=null)
 
 getArmorContents ()
 
 clearAll ()
 
 setArmorContents (array $items)
 
 sendContents ($target)
 
 getHolder ()
 
 getMaxStackSize ()
 
 getName ()
 
 getTitle ()
 
 getItem ($index)
 
 getContents ()
 
 setContents (array $items)
 
 contains (Item $item)
 
 all (Item $item)
 
 remove (Item $item)
 
 first (Item $item)
 
 firstEmpty ()
 
 canAddItem (Item $item)
 
 getViewers ($source=null)
 
 setMaxStackSize ($size)
 
 open (Player $who)
 
 close (Player $who)
 
 onOpen (Player $who)
 
 onClose (Player $who)
 
 sendSlot ($index, $target)
 
 getType ()
 
 addItem (...$slots)
 
 removeItem (...$slots)
 

Public Attributes

const MAX_STACK = 64
 

Protected Attributes

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

Detailed Description

Definition at line 36 of file PlayerInventory.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\PlayerInventory::clear (   $index,
  $source = null 
)

Will clear a specific slot

Parameters
int$index
Player$source
Returns
bool

Implements pocketmine\inventory\Inventory.

Definition at line 250 of file PlayerInventory.php.

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

Referenced by pocketmine\inventory\PlayerInventory\clearAll(), pocketmine\inventory\PlayerInventory\setArmorContents(), and pocketmine\inventory\PlayerInventory\setItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\PlayerInventory::clearAll ( )

Clears all the slots

Implements pocketmine\inventory\Inventory.

Definition at line 302 of file PlayerInventory.php.

References pocketmine\inventory\PlayerInventory\clear().

+ 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\PlayerInventory::getArmorContents ( )
Returns
Item[]

Definition at line 292 of file PlayerInventory.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\PlayerInventory::getHolder ( )
Returns
Human|Player

Implements pocketmine\inventory\Inventory.

Definition at line 472 of file PlayerInventory.php.

Referenced by pocketmine\inventory\PlayerInventory\clear(), pocketmine\inventory\PlayerInventory\onSlotChange(), pocketmine\inventory\PlayerInventory\sendContents(), pocketmine\inventory\PlayerInventory\sendHeldItem(), and pocketmine\inventory\PlayerInventory\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\BaseInventory::onClose ( Player  $who)
inherited
Parameters
Player$who

Implements pocketmine\inventory\Inventory.

Definition at line 409 of file BaseInventory.php.

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

Implements pocketmine\inventory\Inventory.

Definition at line 405 of file BaseInventory.php.

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

+ Here is the caller graph for this function:

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

Implements pocketmine\inventory\Inventory.

Definition at line 158 of file PlayerInventory.php.

References pocketmine\inventory\PlayerInventory\getHolder(), and pocketmine\inventory\BaseInventory\getViewers().

Referenced by pocketmine\inventory\PlayerInventory\clear(), and pocketmine\inventory\PlayerInventory\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\PlayerInventory::sendContents (   $target)
Parameters
Player|Player[]$target

Implements pocketmine\inventory\Inventory.

Definition at line 413 of file PlayerInventory.php.

References pocketmine\inventory\PlayerInventory\getHolder(), and pocketmine\inventory\BaseInventory\getItem().

Referenced by pocketmine\inventory\PlayerInventory\sendHeldItem().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\PlayerInventory::sendHeldItem (   $target)
Parameters
Player|Player[]$target

Definition at line 132 of file PlayerInventory.php.

References pocketmine\inventory\PlayerInventory\getHolder(), and pocketmine\inventory\PlayerInventory\sendContents().

+ Here is the call 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\PlayerInventory::setArmorContents ( array  $items)
Parameters
Item[]$items

Definition at line 352 of file PlayerInventory.php.

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

+ Here is the call 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\PlayerInventory::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

Implements pocketmine\inventory\Inventory.

Definition at line 211 of file PlayerInventory.php.

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

Referenced by pocketmine\inventory\PlayerInventory\setArmorContents(), and pocketmine\inventory\PlayerInventory\setItemInHand().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\inventory\PlayerInventory::setItemInHand ( Item  $item,
  $source = null 
)
Parameters
Item$item
$source
Returns
bool

Definition at line 95 of file PlayerInventory.php.

References pocketmine\inventory\PlayerInventory\setItem().

+ Here is the call 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: