mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
World: flip orderChunkPopulation() condition around
this makes it more obvious that the code is similar to requestChunkPopulation() barring one distinct difference.
This commit is contained in:
parent
8f803df511
commit
afb54f1ae4
@ -2840,7 +2840,16 @@ class World implements ChunkManager{
|
|||||||
$temporaryChunkLoader = new class implements ChunkLoader{};
|
$temporaryChunkLoader = new class implements ChunkLoader{};
|
||||||
$this->registerChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ);
|
$this->registerChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ);
|
||||||
$chunk = $this->loadChunk($chunkX, $chunkZ);
|
$chunk = $this->loadChunk($chunkX, $chunkZ);
|
||||||
if($chunk === null || !$chunk->isPopulated()){
|
if($chunk !== null && $chunk->isPopulated()){
|
||||||
|
$this->unregisterChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ);
|
||||||
|
|
||||||
|
//chunk is already populated; return a pre-resolved promise that will directly fire callbacks assigned
|
||||||
|
$resolver ??= new PromiseResolver();
|
||||||
|
unset($this->chunkPopulationRequestMap[$chunkHash]);
|
||||||
|
$resolver->resolve($chunk);
|
||||||
|
return $resolver->getPromise();
|
||||||
|
}
|
||||||
|
|
||||||
Timings::$population->startTiming();
|
Timings::$population->startTiming();
|
||||||
|
|
||||||
for($xx = -1; $xx <= 1; ++$xx){
|
for($xx = -1; $xx <= 1; ++$xx){
|
||||||
@ -2880,15 +2889,6 @@ class World implements ChunkManager{
|
|||||||
return $resolver->getPromise();
|
return $resolver->getPromise();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->unregisterChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ);
|
|
||||||
|
|
||||||
//chunk is already populated; return a pre-resolved promise that will directly fire callbacks assigned
|
|
||||||
$resolver ??= new PromiseResolver();
|
|
||||||
unset($this->chunkPopulationRequestMap[$chunkHash]);
|
|
||||||
$resolver->resolve($chunk);
|
|
||||||
return $resolver->getPromise();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Chunk[] $adjacentChunks chunkHash => chunk
|
* @param Chunk[] $adjacentChunks chunkHash => chunk
|
||||||
* @phpstan-param array<int, Chunk> $adjacentChunks
|
* @phpstan-param array<int, Chunk> $adjacentChunks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user