PHP Class pocketmine\inventory\PlayerInventory

Inheritance: extends BaseInventory
Show file Open project: iTXTech/Genisys Class Usage Examples

Protected Properties

Property Type Description
$hotbar int[]
$itemInHandIndex

Public Methods

Method Description
__construct ( Human $player, $contents = null )
clear ( $index, $send = true )
clearAll ( )
getArmorContents ( ) : Item[]
getArmorItem ( $index )
getBoots ( )
getChestplate ( )
getHeldItemIndex ( ) : integer
getHeldItemSlot ( ) : integer
getHelmet ( )
getHolder ( ) : Human | Player
getHotbar ( ) : int[]
getHotbarSize ( )
getHotbarSlotIndex ( integer $index ) : integer
getItemInHand ( ) : Item
getLeggings ( )
getSize ( )
onSlotChange ( $index, $before, $send )
sendArmorContents ( Player | Player[] $target )
sendArmorSlot ( integer $index, Player | Player[] $target )
sendContents ( Player | Player[] $target )
sendHeldItem ( Player | Player[] $target )
sendSlot ( integer $index, Player | Player[] $target )
setArmorContents ( array $items )
setArmorItem ( $index, Item $item )
setBoots ( Item $boots )
setChestplate ( Item $chestplate )
setHeldItemIndex ( integer $hotbarSlotIndex, boolean $sendToHolder = true, integer $slotMapping = null )
setHeldItemSlot ( integer $slot )
setHelmet ( Item $helmet )
setHotbarSlotIndex ( $index, $slot )
setItem ( $index, Item $item, $send = true )
setItemInHand ( Item $item ) : boolean
setLeggings ( Item $leggings )
setSize ( $size )

Method Details

__construct() public method

public __construct ( Human $player, $contents = null )
$player pocketmine\entity\Human

clear() public method

public clear ( $index, $send = true )

clearAll() public method

public clearAll ( )

getArmorContents() public method

public getArmorContents ( ) : Item[]
return pocketmine\item\Item[]

getArmorItem() public method

public getArmorItem ( $index )

getBoots() public method

public getBoots ( )

getChestplate() public method

public getChestplate ( )

getHeldItemIndex() public method

public getHeldItemIndex ( ) : integer
return integer Returns the index of the inventory slot the player is currently holding

getHeldItemSlot() public method

public getHeldItemSlot ( ) : integer
return integer Returns the inventory slot index of the currently equipped slot

getHelmet() public method

public getHelmet ( )

getHolder() public method

public getHolder ( ) : Human | Player
return pocketmine\entity\Human | pocketmine\Player

getHotbar() public method

public getHotbar ( ) : int[]
return int[] Returns an array of hotbar indices

getHotbarSize() public method

public getHotbarSize ( )

getHotbarSlotIndex() public method

public getHotbarSlotIndex ( integer $index ) : integer
$index integer
return integer Returns the index of the inventory slot linked to the specified hotbar slot

getItemInHand() public method

public getItemInHand ( ) : Item
return pocketmine\item\Item Returns the item the player is currently holding

getLeggings() public method

public getLeggings ( )

getSize() public method

public getSize ( )

onSlotChange() public method

public onSlotChange ( $index, $before, $send )

sendArmorContents() public method

public sendArmorContents ( Player | Player[] $target )
$target pocketmine\Player | pocketmine\Player[]

sendArmorSlot() public method

public sendArmorSlot ( integer $index, Player | Player[] $target )
$index integer
$target pocketmine\Player | pocketmine\Player[]

sendContents() public method

public sendContents ( Player | Player[] $target )
$target pocketmine\Player | pocketmine\Player[]

sendHeldItem() public method

public sendHeldItem ( Player | Player[] $target )
$target pocketmine\Player | pocketmine\Player[]

sendSlot() public method

public sendSlot ( integer $index, Player | Player[] $target )
$index integer
$target pocketmine\Player | pocketmine\Player[]

setArmorContents() public method

public setArmorContents ( array $items )
$items array

setArmorItem() public method

public setArmorItem ( $index, Item $item )
$item pocketmine\item\Item

setBoots() public method

public setBoots ( Item $boots )
$boots pocketmine\item\Item

setChestplate() public method

public setChestplate ( Item $chestplate )
$chestplate pocketmine\item\Item

setHeldItemIndex() public method

public setHeldItemIndex ( integer $hotbarSlotIndex, boolean $sendToHolder = true, integer $slotMapping = null )
$hotbarSlotIndex integer
$sendToHolder boolean
$slotMapping integer Sets which hotbar slot the player is currently holding. Allows slot remapping as specified by a MobEquipmentPacket. DO NOT CHANGE SLOT MAPPING IN PLUGINS! This new implementation is fully compatible with older APIs. NOTE: Slot mapping is the raw slot index sent by MCPE, which will be between 9 and 44.

setHeldItemSlot() public method

Deprecation:
public setHeldItemSlot ( integer $slot )
$slot integer

setHelmet() public method

public setHelmet ( Item $helmet )
$helmet pocketmine\item\Item

setHotbarSlotIndex() public method

Deprecation: Changes the linkage of the specified hotbar slot. This should never be done unless it is requested by the client.
public setHotbarSlotIndex ( $index, $slot )

setItem() public method

public setItem ( $index, Item $item, $send = true )
$item pocketmine\item\Item

setItemInHand() public method

public setItemInHand ( Item $item ) : boolean
$item pocketmine\item\Item
return boolean Sets the item in the inventory slot the player is currently holding.

setLeggings() public method

public setLeggings ( Item $leggings )
$leggings pocketmine\item\Item

setSize() public method

public setSize ( $size )

Property Details

$hotbar protected property

protected int[] $hotbar
return int[]

$itemInHandIndex protected property

protected $itemInHandIndex