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));
}
}