Clear chunk cache on tile change

This commit is contained in:
Shoghi Cervantes 2015-06-04 17:36:06 +02:00
parent 71490f60f2
commit 188f4d7778
2 changed files with 11 additions and 0 deletions

View File

@ -800,6 +800,10 @@ class Level implements ChunkManager, Metadatable{
}
public function clearChunkCache($chunkX, $chunkZ){
unset($this->chunkCache[Level::chunkHash($chunkX, $chunkZ)]);
}
private function tickChunks(){
if($this->chunksPerTick <= 0 or count($this->players) === 0){
$this->chunkTickList = [];
@ -2271,6 +2275,7 @@ class Level implements ChunkManager, Metadatable{
throw new LevelException("Invalid Tile level");
}
$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->updateTiles[$tile->getId()]);
$this->clearChunkCache($tile->getX() >> 4, $tile->getZ() >> 4);
}
/**

View File

@ -57,6 +57,11 @@ class Sign extends Spawnable{
$this->namedtag->Text4 = new String("Text4", $line4);
$this->spawnToAll();
if($this->chunk){
$this->chunk->setChanged();
$this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ());
}
return true;
}