mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 03:08:58 +00:00
Clear chunk cache on tile change
This commit is contained in:
parent
71490f60f2
commit
188f4d7778
@ -800,6 +800,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clearChunkCache($chunkX, $chunkZ){
|
||||||
|
unset($this->chunkCache[Level::chunkHash($chunkX, $chunkZ)]);
|
||||||
|
}
|
||||||
|
|
||||||
private function tickChunks(){
|
private function tickChunks(){
|
||||||
if($this->chunksPerTick <= 0 or count($this->players) === 0){
|
if($this->chunksPerTick <= 0 or count($this->players) === 0){
|
||||||
$this->chunkTickList = [];
|
$this->chunkTickList = [];
|
||||||
@ -2271,6 +2275,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
throw new LevelException("Invalid Tile level");
|
throw new LevelException("Invalid Tile level");
|
||||||
}
|
}
|
||||||
$this->tiles[$tile->getId()] = $tile;
|
$this->tiles[$tile->getId()] = $tile;
|
||||||
|
$this->clearChunkCache($tile->getX() >> 4, $tile->getZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2285,6 +2290,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
unset($this->tiles[$tile->getId()]);
|
unset($this->tiles[$tile->getId()]);
|
||||||
unset($this->updateTiles[$tile->getId()]);
|
unset($this->updateTiles[$tile->getId()]);
|
||||||
|
$this->clearChunkCache($tile->getX() >> 4, $tile->getZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,6 +57,11 @@ class Sign extends Spawnable{
|
|||||||
$this->namedtag->Text4 = new String("Text4", $line4);
|
$this->namedtag->Text4 = new String("Text4", $line4);
|
||||||
$this->spawnToAll();
|
$this->spawnToAll();
|
||||||
|
|
||||||
|
if($this->chunk){
|
||||||
|
$this->chunk->setChanged();
|
||||||
|
$this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user