mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
World: use Facing::OFFSET in getHighestAdjacentLight()
This commit is contained in:
parent
6ac45526f9
commit
1cf508abdb
@ -1727,14 +1727,10 @@ class World implements ChunkManager{
|
|||||||
*/
|
*/
|
||||||
private function getHighestAdjacentLight(int $x, int $y, int $z, \Closure $lightGetter) : int{
|
private function getHighestAdjacentLight(int $x, int $y, int $z, \Closure $lightGetter) : int{
|
||||||
$max = 0;
|
$max = 0;
|
||||||
foreach([
|
foreach(Facing::OFFSET as [$offsetX, $offsetY, $offsetZ]){
|
||||||
[$x + 1, $y, $z],
|
$x1 = $x + $offsetX;
|
||||||
[$x - 1, $y, $z],
|
$y1 = $y + $offsetY;
|
||||||
[$x, $y + 1, $z],
|
$z1 = $z + $offsetZ;
|
||||||
[$x, $y - 1, $z],
|
|
||||||
[$x, $y, $z + 1],
|
|
||||||
[$x, $y, $z - 1]
|
|
||||||
] as [$x1, $y1, $z1]){
|
|
||||||
if(
|
if(
|
||||||
!$this->isInWorld($x1, $y1, $z1) ||
|
!$this->isInWorld($x1, $y1, $z1) ||
|
||||||
($chunk = $this->getChunk($x1 >> Chunk::COORD_BIT_SIZE, $z1 >> Chunk::COORD_BIT_SIZE)) === null ||
|
($chunk = $this->getChunk($x1 >> Chunk::COORD_BIT_SIZE, $z1 >> Chunk::COORD_BIT_SIZE)) === null ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user