mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
World: depopulate neighbourBlockUpdateQueueIndex sooner
this fixes 2 problems: 1) Blocks which set themselves to something else during onNearbyBlockChange() would not receive any block update 2) A memory leak when blocks in unloaded chunks were scheduled for an update. I'm a little uneasy about this change, because there must have been some reason why I put this at the end of the block and not at the start, but whatever it is, I can't reason about it, and there's reasons not to put it at the end too.
This commit is contained in:
parent
b9b1ba9526
commit
ba2bfe0e11
@ -804,6 +804,7 @@ class World implements ChunkManager{
|
||||
//Normal updates
|
||||
while($this->neighbourBlockUpdateQueue->count() > 0){
|
||||
$index = $this->neighbourBlockUpdateQueue->dequeue();
|
||||
unset($this->neighbourBlockUpdateQueueIndex[$index]);
|
||||
World::getBlockXYZ($index, $x, $y, $z);
|
||||
if(!$this->isChunkLoaded($x >> 4, $z >> 4)){
|
||||
continue;
|
||||
@ -820,7 +821,6 @@ class World implements ChunkManager{
|
||||
}
|
||||
$block->onNearbyBlockChange();
|
||||
}
|
||||
unset($this->neighbourBlockUpdateQueueIndex[$index]);
|
||||
}
|
||||
|
||||
$this->timings->scheduledBlockUpdates->stopTiming();
|
||||
|
Loading…
x
Reference in New Issue
Block a user