mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 18:41:47 +00:00
World: check population locks _after_ checking if the chunk is already populated, not before
this led to another case where a population request would be queued up for an already-populated chunk for no reason.
This commit is contained in:
parent
f4a3c40b5c
commit
8f803df511
@ -2836,14 +2836,6 @@ class World implements ChunkManager{
|
|||||||
//generation is already running
|
//generation is already running
|
||||||
return $resolver->getPromise();
|
return $resolver->getPromise();
|
||||||
}
|
}
|
||||||
for($xx = -1; $xx <= 1; ++$xx){
|
|
||||||
for($zz = -1; $zz <= 1; ++$zz){
|
|
||||||
if($this->isChunkLocked($chunkX + $xx, $chunkZ + $zz)){
|
|
||||||
//chunk is already in use by another generation request; queue the request for later
|
|
||||||
return $resolver?->getPromise() ?? $this->enqueuePopulationRequest($chunkX, $chunkZ, $associatedChunkLoader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$temporaryChunkLoader = new class implements ChunkLoader{};
|
$temporaryChunkLoader = new class implements ChunkLoader{};
|
||||||
$this->registerChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ);
|
$this->registerChunkLoader($temporaryChunkLoader, $chunkX, $chunkZ);
|
||||||
@ -2851,6 +2843,15 @@ class World implements ChunkManager{
|
|||||||
if($chunk === null || !$chunk->isPopulated()){
|
if($chunk === null || !$chunk->isPopulated()){
|
||||||
Timings::$population->startTiming();
|
Timings::$population->startTiming();
|
||||||
|
|
||||||
|
for($xx = -1; $xx <= 1; ++$xx){
|
||||||
|
for($zz = -1; $zz <= 1; ++$zz){
|
||||||
|
if($this->isChunkLocked($chunkX + $xx, $chunkZ + $zz)){
|
||||||
|
//chunk is already in use by another generation request; queue the request for later
|
||||||
|
return $resolver?->getPromise() ?? $this->enqueuePopulationRequest($chunkX, $chunkZ, $associatedChunkLoader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->activeChunkPopulationTasks[$chunkHash] = true;
|
$this->activeChunkPopulationTasks[$chunkHash] = true;
|
||||||
if($resolver === null){
|
if($resolver === null){
|
||||||
$resolver = new PromiseResolver();
|
$resolver = new PromiseResolver();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user