pocketmine\inventory\BaseInventory::__construct PHP Method

__construct() public method

public __construct ( pocketmine\inventory\InventoryHolder $holder, InventoryType $type, array $items = [], integer $overrideSize = null, string $overrideTitle = null )
$holder pocketmine\inventory\InventoryHolder
$type InventoryType
$items array
$overrideSize integer
$overrideTitle string
    public function __construct(InventoryHolder $holder, InventoryType $type, array $items = [], $overrideSize = null, $overrideTitle = null)
    {
        $this->holder = $holder;
        $this->type = $type;
        if ($overrideSize !== null) {
            $this->size = (int) $overrideSize;
        } else {
            $this->size = $this->type->getDefaultSize();
        }
        if ($overrideTitle !== null) {
            $this->title = $overrideTitle;
        } else {
            $this->title = $this->type->getDefaultTitle();
        }
        $this->name = $this->type->getDefaultTitle();
        $this->setContents($items);
    }

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);
 }
All Usage Examples Of pocketmine\inventory\BaseInventory::__construct