mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 12:27:51 +00:00
World: assume that the primary active chunk is not NULL in generateChunkCallback()
This commit is contained in:
parent
34bb225566
commit
d1387ebd0a
@ -2005,6 +2005,9 @@ class World implements ChunkManager{
|
|||||||
public function generateChunkCallback(int $x, int $z, ?Chunk $chunk) : void{
|
public function generateChunkCallback(int $x, int $z, ?Chunk $chunk) : void{
|
||||||
Timings::$generationCallback->startTiming();
|
Timings::$generationCallback->startTiming();
|
||||||
if(isset($this->activeChunkPopulationTasks[$index = World::chunkHash($x, $z)])){
|
if(isset($this->activeChunkPopulationTasks[$index = World::chunkHash($x, $z)])){
|
||||||
|
if($chunk === null){
|
||||||
|
throw new AssumptionFailedError("Primary chunk should never be NULL");
|
||||||
|
}
|
||||||
for($xx = -1; $xx <= 1; ++$xx){
|
for($xx = -1; $xx <= 1; ++$xx){
|
||||||
for($zz = -1; $zz <= 1; ++$zz){
|
for($zz = -1; $zz <= 1; ++$zz){
|
||||||
$this->unlockChunk($x + $xx, $z + $zz);
|
$this->unlockChunk($x + $xx, $z + $zz);
|
||||||
@ -2012,7 +2015,6 @@ class World implements ChunkManager{
|
|||||||
}
|
}
|
||||||
unset($this->activeChunkPopulationTasks[$index]);
|
unset($this->activeChunkPopulationTasks[$index]);
|
||||||
|
|
||||||
if($chunk !== null){
|
|
||||||
$oldChunk = $this->loadChunk($x, $z);
|
$oldChunk = $this->loadChunk($x, $z);
|
||||||
$this->setChunk($x, $z, $chunk, false);
|
$this->setChunk($x, $z, $chunk, false);
|
||||||
if(($oldChunk === null or !$oldChunk->isPopulated()) and $chunk->isPopulated()){
|
if(($oldChunk === null or !$oldChunk->isPopulated()) and $chunk->isPopulated()){
|
||||||
@ -2022,7 +2024,6 @@ class World implements ChunkManager{
|
|||||||
$listener->onChunkPopulated($x, $z, $chunk);
|
$listener->onChunkPopulated($x, $z, $chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}elseif($this->isChunkLocked($x, $z)){
|
}elseif($this->isChunkLocked($x, $z)){
|
||||||
$this->unlockChunk($x, $z);
|
$this->unlockChunk($x, $z);
|
||||||
if($chunk !== null){
|
if($chunk !== null){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user