inventory = new BrewingStandInventory($this->pos); $this->inventory->getListeners()->add(CallbackInventoryListener::onAnyChange(function(Inventory $unused) : void{ $this->pos->getWorldNonNull()->scheduleDelayedBlockUpdate($this->pos, 1); })); } public function readSaveData(CompoundTag $nbt) : void{ $this->loadName($nbt); $this->loadItems($nbt); $this->brewTime = $nbt->getShort(self::TAG_BREW_TIME, $nbt->getShort(self::TAG_BREW_TIME_PE, 0)); $this->maxFuelTime = $nbt->getShort(self::TAG_MAX_FUEL_TIME, 0); $this->remainingFuelTime = $nbt->getByte(self::TAG_REMAINING_FUEL_TIME, $nbt->getShort(self::TAG_REMAINING_FUEL_TIME_PE, 0)); if($this->maxFuelTime === 0){ $this->maxFuelTime = $this->remainingFuelTime; } if($this->remainingFuelTime === 0){ $this->maxFuelTime = $this->remainingFuelTime = $this->brewTime = 0; } } protected function writeSaveData(CompoundTag $nbt) : void{ $this->saveName($nbt); $this->saveItems($nbt); $nbt->setShort(self::TAG_BREW_TIME_PE, $this->brewTime); $nbt->setShort(self::TAG_MAX_FUEL_TIME, $this->maxFuelTime); $nbt->setShort(self::TAG_REMAINING_FUEL_TIME_PE, $this->remainingFuelTime); } public function getDefaultName() : string{ return "Brewing Stand"; } public function close() : void{ if(!$this->closed){ $this->inventory->removeAllViewers(); $this->inventory = null; parent::close(); } } /** * @return BrewingStandInventory */ public function getInventory(){ return $this->inventory; } /** * @return BrewingStandInventory */ public function getRealInventory(){ return $this->inventory; } }