PocketMine-MP 5.33.2 git-1133d49c924b4358c79d44eeb97dcbf56cb4d1eb
Loading...
Searching...
No Matches
pocketmine\inventory\Hotbar Class Reference
+ Collaboration diagram for pocketmine\inventory\Hotbar:

Public Member Functions

 __construct (private int $size=9)
 
 getSelectedIndex ()
 
 getSelectedIndexChangeListeners ()
 
 getSize ()
 
 isHotbarSlot (int $slot)
 
 setSelectedIndex (int $hotbarSlot)
 

Protected Attributes

int $selectedIndex = 0
 
ObjectSet $selectedIndexChangeListeners
 

Detailed Description

Definition at line 28 of file Hotbar.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\inventory\Hotbar::__construct ( private int $size = 9)

Definition at line 37 of file Hotbar.php.

Member Function Documentation

◆ getSelectedIndex()

pocketmine\inventory\Hotbar::getSelectedIndex ( )

Returns the hotbar slot number the holder is currently holding.

Definition at line 59 of file Hotbar.php.

◆ getSelectedIndexChangeListeners()

pocketmine\inventory\Hotbar::getSelectedIndexChangeListeners ( )
Returns
\Closure[]|ObjectSet @phpstan-return ObjectSet<\Closure(int $oldIndex) : void>

Definition at line 85 of file Hotbar.php.

◆ getSize()

pocketmine\inventory\Hotbar::getSize ( )

Returns the number of slots in the hotbar.

Definition at line 90 of file Hotbar.php.

◆ isHotbarSlot()

pocketmine\inventory\Hotbar::isHotbarSlot ( int $slot)

Definition at line 43 of file Hotbar.php.

◆ setSelectedIndex()

pocketmine\inventory\Hotbar::setSelectedIndex ( int $hotbarSlot)

Sets which hotbar slot the player is currently loading.

Parameters
int$hotbarSlot0-8 index of the hotbar slot to hold
Exceptions

InvalidArgumentException if the hotbar slot is out of range

Definition at line 70 of file Hotbar.php.

Member Data Documentation

◆ $selectedIndex

int pocketmine\inventory\Hotbar::$selectedIndex = 0
protected

Definition at line 29 of file Hotbar.php.

◆ $selectedIndexChangeListeners

ObjectSet pocketmine\inventory\Hotbar::$selectedIndexChangeListeners
protected

Definition at line 35 of file Hotbar.php.


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