mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 00:09:39 +00:00
World: don't create a new chunk just to read biome info
the chunk won't be generated, so we can provide the default result without creating a new chunk for no reason.
This commit is contained in:
parent
de867f1b86
commit
dec235abab
@ -1858,7 +1858,10 @@ class World implements ChunkManager{
|
||||
}
|
||||
|
||||
public function getBiomeId(int $x, int $z) : int{
|
||||
return $this->getOrLoadChunk($x >> 4, $z >> 4, true)->getBiomeId($x & 0x0f, $z & 0x0f);
|
||||
if(($chunk = $this->getOrLoadChunk($x >> 4, $z >> 4, false)) !== null){
|
||||
return $chunk->getBiomeId($x & 0x0f, $z & 0x0f);
|
||||
}
|
||||
return Biome::OCEAN; //TODO: this should probably throw instead (terrain not generated yet)
|
||||
}
|
||||
|
||||
public function getBiome(int $x, int $z) : Biome{
|
||||
|
Loading…
x
Reference in New Issue
Block a user