Skip to content

PlayerInventory ​

class · pocketmine\inventory\PlayerInventory · source

Extends SimpleInventory

Properties ​

$heldItemIndexChangeListeners protected ​

php
protected \pocketmine\utils\ObjectSet $heldItemIndexChangeListeners

$holder protected ​

php
protected \pocketmine\entity\Human $holder

$itemInHandIndex protected ​

php
protected int $itemInHandIndex

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\Human $player)

getHeldItemIndex() ​

php
public function getHeldItemIndex() : int

Returns the hotbar slot number the holder is currently holding.

getHeldItemIndexChangeListeners() ​

php
public function getHeldItemIndexChangeListeners() : \pocketmine\utils\ObjectSet

getHolder() ​

php
public function getHolder() : \pocketmine\entity\Human

getHotbarSize() ​

php
public function getHotbarSize() : int

Returns the number of slots in the hotbar.

getHotbarSlotItem() ​

php
public function getHotbarSlotItem(int $hotbarSlot) : \pocketmine\item\Item

Returns the item in the specified hotbar slot.

getItemInHand() ​

php
public function getItemInHand() : \pocketmine\item\Item

Returns the currently-held item.

isHotbarSlot() ​

php
public function isHotbarSlot(int $slot) : bool

setHeldItemIndex() ​

php
public function setHeldItemIndex(int $hotbarSlot) : void

Sets which hotbar slot the player is currently loading.

setItemInHand() ​

php
public function setItemInHand(\pocketmine\item\Item $item) : void

Sets the item in the currently-held slot to the specified item.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.