Level: Fixed race condition between direct and batched block updating

This happened when a block was set into the world with a direct update, when an entry for that block was already present in the changedBlocks map. This fixes the bug by removing the entry from the changedBlocks map to avoid sending outdated block updates in batches.
This commit is contained in:
Dylan K. Taylor 2018-03-16 11:44:57 +00:00
parent e88541b269
commit d542bbc736

View File

@ -1529,7 +1529,7 @@ class Level implements ChunkManager, Metadatable{
if($direct === true){
$this->sendBlocks($this->getChunkPlayers($pos->x >> 4, $pos->z >> 4), [$block], UpdateBlockPacket::FLAG_ALL_PRIORITY);
unset($this->chunkCache[$chunkHash]);
unset($this->chunkCache[$chunkHash], $this->changedBlocks[$chunkHash][$blockHash]);
}else{
if(!isset($this->changedBlocks[$chunkHash])){
$this->changedBlocks[$chunkHash] = [];