pocketmine\inventory\Inventory::firstEmpty PHP Method

firstEmpty() public method

Returns the first empty slot, or -1 if not found
public firstEmpty ( ) : integer
return integer
    public function firstEmpty();

Usage Example

Example #1
0
 /**
  * @param Inventory $inventory
  */
 public function addToInventory(Inventory $inventory)
 {
     foreach ($this->getItems() as $i) {
         $inventory->setItem($inventory->firstEmpty(), clone $i);
     }
     // call_user_func_array($inventory->addItem(), $this->getItems());
 }