inventory = new HopperInventory($this->position); } public function readSaveData(CompoundTag $nbt) : void{ $this->loadItems($nbt); $this->loadName($nbt); $this->transferCooldown = $nbt->getInt(self::TAG_TRANSFER_COOLDOWN, 0); } protected function writeSaveData(CompoundTag $nbt) : void{ $this->saveItems($nbt); $this->saveName($nbt); $nbt->setInt(self::TAG_TRANSFER_COOLDOWN, $this->transferCooldown); } public function close() : void{ if(!$this->closed){ $this->inventory->removeAllViewers(); parent::close(); } } public function getDefaultName() : string{ return "Hopper"; } /** * @return HopperInventory */ public function getInventory(){ return $this->inventory; } /** * @return HopperInventory */ public function getRealInventory(){ return $this->inventory; } }