diff --git a/src/block/FrostedIce.php b/src/block/FrostedIce.php index 70563050a..00ddadbca 100644 --- a/src/block/FrostedIce.php +++ b/src/block/FrostedIce.php @@ -69,10 +69,7 @@ class FrostedIce extends Ice{ public function onRandomTick() : void{ if((!$this->checkAdjacentBlocks(4) or mt_rand(0, 2) === 0) and - max( //TODO: move this to World - $this->pos->getWorld()->getHighestAdjacentBlockLight($this->pos->x, $this->pos->y, $this->pos->z), - $this->pos->getWorld()->getHighestAdjacentRealBlockSkyLight($this->pos->x, $this->pos->y, $this->pos->z) - ) >= 12 - $this->age){ + $this->pos->getWorld()->getHighestAdjacentFullLightAt($this->pos->x, $this->pos->y, $this->pos->z) >= 12 - $this->age){ if($this->tryMelt()){ foreach($this->getAllSides() as $block){ if($block instanceof FrostedIce){ diff --git a/src/world/World.php b/src/world/World.php index 305500bd6..384bfc6a0 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1293,6 +1293,14 @@ class World implements ChunkManager{ } } + /** + * Returns the highest available level of any type of light at, or adjacent to, the given coordinates, adjusted for + * the current weather and time of day. + */ + public function getHighestAdjacentFullLightAt(int $x, int $y, int $z) : int{ + return $this->getHighestAdjacentLight($x, $y, $z, \Closure::fromCallable([$this, 'getFullLightAt'])); + } + /** * Gets the raw block skylight level * diff --git a/tests/phpstan/configs/l7-baseline.neon b/tests/phpstan/configs/l7-baseline.neon index 2274d14ac..e54fab02b 100644 --- a/tests/phpstan/configs/l7-baseline.neon +++ b/tests/phpstan/configs/l7-baseline.neon @@ -171,12 +171,7 @@ parameters: path: ../../../src/block/FrostedIce.php - - message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentBlockLight\\(\\) expects int, float\\|int given\\.$#" - count: 1 - path: ../../../src/block/FrostedIce.php - - - - message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentRealBlockSkyLight\\(\\) expects int, float\\|int given\\.$#" + message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentFullLightAt\\(\\) expects int, float\\|int given\\.$#" count: 1 path: ../../../src/block/FrostedIce.php @@ -186,12 +181,7 @@ parameters: path: ../../../src/block/FrostedIce.php - - message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentBlockLight\\(\\) expects int, float\\|int given\\.$#" - count: 1 - path: ../../../src/block/FrostedIce.php - - - - message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentRealBlockSkyLight\\(\\) expects int, float\\|int given\\.$#" + message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentFullLightAt\\(\\) expects int, float\\|int given\\.$#" count: 1 path: ../../../src/block/FrostedIce.php @@ -201,12 +191,7 @@ parameters: path: ../../../src/block/FrostedIce.php - - message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentBlockLight\\(\\) expects int, float\\|int given\\.$#" - count: 1 - path: ../../../src/block/FrostedIce.php - - - - message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentRealBlockSkyLight\\(\\) expects int, float\\|int given\\.$#" + message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentFullLightAt\\(\\) expects int, float\\|int given\\.$#" count: 1 path: ../../../src/block/FrostedIce.php