pocketmine\inventory\ChestInventory::getContents PHP Method

getContents() public method

public getContents ( $withAir = false )
    public function getContents($withAir = false)
    {
        if ($withAir) {
            $contents = [];
            for ($i = 0; $i < $this->getSize(); ++$i) {
                $contents[$i] = $this->getItem($i);
            }
            return $contents;
        }
        return parent::getContents();
    }

Usage Example

 public function __construct(Chest $left, Chest $right)
 {
     $this->left = $left->getRealInventory();
     $this->right = $right->getRealInventory();
     $items = array_merge($this->left->getContents(), $this->right->getContents());
     BaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST), $items);
 }