mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 04:38:35 +00:00
World: do not access chunks for light if they aren't yet light-populated
This commit is contained in:
parent
ab9615fb9c
commit
e6ecacbb2b
@ -1921,7 +1921,7 @@ class World implements ChunkManager{
|
|||||||
if(!$this->isInWorld($x, $y, $z)){
|
if(!$this->isInWorld($x, $y, $z)){
|
||||||
return $y >= self::Y_MAX ? 15 : 0;
|
return $y >= self::Y_MAX ? 15 : 0;
|
||||||
}
|
}
|
||||||
if(($chunk = $this->getChunk($x >> 4, $z >> 4)) !== null){
|
if(($chunk = $this->getChunk($x >> 4, $z >> 4)) !== null && $chunk->isLightPopulated() === true){
|
||||||
return $chunk->getSubChunk($y >> 4)->getBlockSkyLightArray()->get($x & 0x0f, $y & 0xf, $z & 0x0f);
|
return $chunk->getSubChunk($y >> 4)->getBlockSkyLightArray()->get($x & 0x0f, $y & 0xf, $z & 0x0f);
|
||||||
}
|
}
|
||||||
return 0; //TODO: this should probably throw instead (light not calculated yet)
|
return 0; //TODO: this should probably throw instead (light not calculated yet)
|
||||||
@ -1936,7 +1936,7 @@ class World implements ChunkManager{
|
|||||||
if(!$this->isInWorld($x, $y, $z)){
|
if(!$this->isInWorld($x, $y, $z)){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(($chunk = $this->getChunk($x >> 4, $z >> 4)) !== null){
|
if(($chunk = $this->getChunk($x >> 4, $z >> 4)) !== null && $chunk->isLightPopulated() === true){
|
||||||
return $chunk->getSubChunk($y >> 4)->getBlockLightArray()->get($x & 0x0f, $y & 0xf, $z & 0x0f);
|
return $chunk->getSubChunk($y >> 4)->getBlockLightArray()->get($x & 0x0f, $y & 0xf, $z & 0x0f);
|
||||||
}
|
}
|
||||||
return 0; //TODO: this should probably throw instead (light not calculated yet)
|
return 0; //TODO: this should probably throw instead (light not calculated yet)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user