diff --git a/src/block/tile/Chest.php b/src/block/tile/Chest.php index 614d7f0cd..057aa1991 100644 --- a/src/block/tile/Chest.php +++ b/src/block/tile/Chest.php @@ -188,8 +188,8 @@ class Chest extends Spawnable implements Container, Nameable{ $this->createPair($tile); - $this->setDirty(); - $tile->setDirty(); + $this->clearSpawnCompoundCache(); + $tile->clearSpawnCompoundCache(); $this->checkPairing(); return true; @@ -211,12 +211,12 @@ class Chest extends Spawnable implements Container, Nameable{ $tile = $this->getPair(); $this->pairX = $this->pairZ = null; - $this->setDirty(); + $this->clearSpawnCompoundCache(); if($tile instanceof Chest){ $tile->pairX = $tile->pairZ = null; $tile->checkPairing(); - $tile->setDirty(); + $tile->clearSpawnCompoundCache(); } $this->checkPairing(); diff --git a/src/block/tile/Spawnable.php b/src/block/tile/Spawnable.php index 5b62f1980..5184159df 100644 --- a/src/block/tile/Spawnable.php +++ b/src/block/tile/Spawnable.php @@ -33,21 +33,23 @@ abstract class Spawnable extends Tile{ * @phpstan-var CacheableNbt<\pocketmine\nbt\tag\CompoundTag>|null */ private $spawnCompoundCache = null; - /** @var bool */ - private $dirty = true; //default dirty, until it's been spawned appropriately on the world /** - * Returns whether the tile needs to be respawned to viewers. + * @deprecated */ public function isDirty() : bool{ - return $this->dirty; + return $this->spawnCompoundCache === null; } + /** + * @deprecated + */ public function setDirty(bool $dirty = true) : void{ - if($dirty){ - $this->spawnCompoundCache = null; - } - $this->dirty = $dirty; + $this->clearSpawnCompoundCache(); + } + + public function clearSpawnCompoundCache() : void{ + $this->spawnCompoundCache = null; } /**