pocketmine\tile\Chest::__construct PHP Method

__construct() public method

public __construct ( pocketmine\level\format\FullChunk $chunk, CompoundTag $nbt )
$chunk pocketmine\level\format\FullChunk
$nbt pocketmine\nbt\tag\CompoundTag
    public function __construct(FullChunk $chunk, CompoundTag $nbt)
    {
        parent::__construct($chunk, $nbt);
        $this->inventory = new ChestInventory($this);
        if (!isset($this->namedtag->Items) or !$this->namedtag->Items instanceof ListTag) {
            $this->namedtag->Items = new ListTag("Items", []);
            $this->namedtag->Items->setTagType(NBT::TAG_Compound);
        }
        for ($i = 0; $i < $this->getSize(); ++$i) {
            $this->inventory->setItem($i, $this->getItem($i));
        }
    }