Fixed some issues with world generation and not creating chunks, closes #3008

This commit is contained in:
Shoghi Cervantes
2015-05-11 23:53:01 +02:00
parent de0f653027
commit aa38a4885f
5 changed files with 14 additions and 18 deletions

View File

@ -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{