public function saveNBT() { $this->namedtag->Items = new ListTag("Items", []); $this->namedtag->Items->setTagType(NBT::TAG_Compound); for ($index = 0; $index < $this->getSize(); ++$index) { $this->setItem($index, $this->inventory->getItem($index)); } }