33    protected Human $holder;
 
   34    protected int $itemInHandIndex = 0;
 
   40    protected ObjectSet $heldItemIndexChangeListeners;
 
   42    public function __construct(
Human $player){
 
   43        $this->holder = $player;
 
   44        $this->heldItemIndexChangeListeners = 
new ObjectSet();
 
   45        parent::__construct(36);
 
   48    public function isHotbarSlot(
int $slot) : 
bool{
 
   55    private function throwIfNotHotbarSlot(
int $slot) : 
void{
 
   56        if(!$this->isHotbarSlot($slot)){
 
   57            throw new \InvalidArgumentException(
"$slot is not a valid hotbar slot index (expected 0 - " . ($this->
getHotbarSize() - 1) . 
")");
 
   67        $this->throwIfNotHotbarSlot($hotbarSlot);
 
   68        return $this->
getItem($hotbarSlot);
 
 
   75        return $this->itemInHandIndex;
 
 
   86        $this->throwIfNotHotbarSlot($hotbarSlot);
 
   88        $oldIndex = $this->itemInHandIndex;
 
   89        $this->itemInHandIndex = $hotbarSlot;
 
   91        foreach($this->heldItemIndexChangeListeners as $callback){
 
 
  106        return $this->getHotbarSlotItem($this->itemInHandIndex);
 
 
  113        $this->setItem($this->getHeldItemIndex(), $item);
 
 
  123    public function getHolder() : 
Human{
 
  124        return $this->holder;