mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Fixed some issues with world generation and not creating chunks, closes #3008
This commit is contained in:
@ -1880,7 +1880,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
public function getChunk($x, $z, $create = false){
|
||||
if(isset($this->chunks[$index = Level::chunkHash($x, $z)])){
|
||||
return $this->chunks[$index];
|
||||
}elseif($this->loadChunk($x, $z, $create) and $this->chunks[$index] !== null){
|
||||
}elseif($this->loadChunk($x, $z, $create)){
|
||||
return $this->chunks[$index];
|
||||
}
|
||||
|
||||
@ -2159,21 +2159,16 @@ class Level implements ChunkManager, Metadatable{
|
||||
$this->cancelUnloadChunkRequest($x, $z);
|
||||
|
||||
$chunk = $this->provider->getChunk($x, $z, $generate);
|
||||
if($chunk !== null){
|
||||
$this->chunks[$index] = $chunk;
|
||||
$chunk->initChunk();
|
||||
}else{
|
||||
$this->provider->loadChunk($x, $z, $generate);
|
||||
|
||||
if(($chunk = $this->provider->getChunk($x, $z)) !== null){
|
||||
$this->chunks[$index] = $chunk;
|
||||
$chunk->initChunk();
|
||||
}else{
|
||||
$this->timings->syncChunkLoadTimer->stopTiming();
|
||||
return false;
|
||||
if($chunk === null){
|
||||
if($generate){
|
||||
throw new \InvalidStateException("Could not create new Chunk");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->chunks[$index] = $chunk;
|
||||
$chunk->initChunk();
|
||||
|
||||
if($chunk->getProvider() !== null){
|
||||
$this->server->getPluginManager()->callEvent(new ChunkLoadEvent($chunk, !$chunk->isGenerated()));
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user