mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
Spawnable: remove dead code, deprecate isDirty() and setDirty()
This commit is contained in:
parent
c8a7a53d70
commit
9f5d4180c9
@ -188,8 +188,8 @@ class Chest extends Spawnable implements Container, Nameable{
|
|||||||
|
|
||||||
$this->createPair($tile);
|
$this->createPair($tile);
|
||||||
|
|
||||||
$this->setDirty();
|
$this->clearSpawnCompoundCache();
|
||||||
$tile->setDirty();
|
$tile->clearSpawnCompoundCache();
|
||||||
$this->checkPairing();
|
$this->checkPairing();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -211,12 +211,12 @@ class Chest extends Spawnable implements Container, Nameable{
|
|||||||
$tile = $this->getPair();
|
$tile = $this->getPair();
|
||||||
$this->pairX = $this->pairZ = null;
|
$this->pairX = $this->pairZ = null;
|
||||||
|
|
||||||
$this->setDirty();
|
$this->clearSpawnCompoundCache();
|
||||||
|
|
||||||
if($tile instanceof Chest){
|
if($tile instanceof Chest){
|
||||||
$tile->pairX = $tile->pairZ = null;
|
$tile->pairX = $tile->pairZ = null;
|
||||||
$tile->checkPairing();
|
$tile->checkPairing();
|
||||||
$tile->setDirty();
|
$tile->clearSpawnCompoundCache();
|
||||||
}
|
}
|
||||||
$this->checkPairing();
|
$this->checkPairing();
|
||||||
|
|
||||||
|
@ -33,21 +33,23 @@ abstract class Spawnable extends Tile{
|
|||||||
* @phpstan-var CacheableNbt<\pocketmine\nbt\tag\CompoundTag>|null
|
* @phpstan-var CacheableNbt<\pocketmine\nbt\tag\CompoundTag>|null
|
||||||
*/
|
*/
|
||||||
private $spawnCompoundCache = 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{
|
public function isDirty() : bool{
|
||||||
return $this->dirty;
|
return $this->spawnCompoundCache === null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
public function setDirty(bool $dirty = true) : void{
|
public function setDirty(bool $dirty = true) : void{
|
||||||
if($dirty){
|
$this->clearSpawnCompoundCache();
|
||||||
$this->spawnCompoundCache = null;
|
|
||||||
}
|
}
|
||||||
$this->dirty = $dirty;
|
|
||||||
|
public function clearSpawnCompoundCache() : void{
|
||||||
|
$this->spawnCompoundCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user