mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-14 22:01:59 +00:00
World: added getHighestAdjacentFullLightAt()
This commit is contained in:
parent
51b0685881
commit
53ebe4f9f9
@ -69,10 +69,7 @@ class FrostedIce extends Ice{
|
|||||||
|
|
||||||
public function onRandomTick() : void{
|
public function onRandomTick() : void{
|
||||||
if((!$this->checkAdjacentBlocks(4) or mt_rand(0, 2) === 0) and
|
if((!$this->checkAdjacentBlocks(4) or mt_rand(0, 2) === 0) and
|
||||||
max( //TODO: move this to World
|
$this->pos->getWorld()->getHighestAdjacentFullLightAt($this->pos->x, $this->pos->y, $this->pos->z) >= 12 - $this->age){
|
||||||
$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){
|
|
||||||
if($this->tryMelt()){
|
if($this->tryMelt()){
|
||||||
foreach($this->getAllSides() as $block){
|
foreach($this->getAllSides() as $block){
|
||||||
if($block instanceof FrostedIce){
|
if($block instanceof FrostedIce){
|
||||||
|
@ -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
|
* Gets the raw block skylight level
|
||||||
*
|
*
|
||||||
|
@ -171,12 +171,7 @@ parameters:
|
|||||||
path: ../../../src/block/FrostedIce.php
|
path: ../../../src/block/FrostedIce.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentBlockLight\\(\\) 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
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#1 \\$x of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentRealBlockSkyLight\\(\\) expects int, float\\|int given\\.$#"
|
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/block/FrostedIce.php
|
path: ../../../src/block/FrostedIce.php
|
||||||
|
|
||||||
@ -186,12 +181,7 @@ parameters:
|
|||||||
path: ../../../src/block/FrostedIce.php
|
path: ../../../src/block/FrostedIce.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentBlockLight\\(\\) 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
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentRealBlockSkyLight\\(\\) expects int, float\\|int given\\.$#"
|
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/block/FrostedIce.php
|
path: ../../../src/block/FrostedIce.php
|
||||||
|
|
||||||
@ -201,12 +191,7 @@ parameters:
|
|||||||
path: ../../../src/block/FrostedIce.php
|
path: ../../../src/block/FrostedIce.php
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentBlockLight\\(\\) 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
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Parameter \\#3 \\$z of method pocketmine\\\\world\\\\World\\:\\:getHighestAdjacentRealBlockSkyLight\\(\\) expects int, float\\|int given\\.$#"
|
|
||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/block/FrostedIce.php
|
path: ../../../src/block/FrostedIce.php
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user