Level: fix memory leak on scheduled blockupdate in unloaded chunk

This commit is contained in:
Dylan K. Taylor 2019-07-30 15:37:24 +01:00
parent 0ea9a08963
commit 8f5eb7ef37

View File

@ -822,11 +822,11 @@ class Level implements ChunkManager, Metadatable{
while($this->scheduledBlockUpdateQueue->count() > 0 and $this->scheduledBlockUpdateQueue->current()["priority"] <= $currentTick){
/** @var Vector3 $vec */
$vec = $this->scheduledBlockUpdateQueue->extract()["data"];
unset($this->scheduledBlockUpdateQueueIndex[Level::blockHash($vec->x, $vec->y, $vec->z)]);
if(!$this->isInLoadedTerrain($vec)){
continue;
}
$block = $this->getBlock($vec);
unset($this->scheduledBlockUpdateQueueIndex[Level::blockHash($block->x, $block->y, $block->z)]);
$block->onScheduledUpdate();
}