World: added getHighestAdjacentRealBlockSkyLight()

this is the same as its 'non-real' counterpart, but it accounts for time of day.
This commit is contained in:
Dylan K. Taylor 2020-10-31 16:44:42 +00:00
parent 0b92e96e14
commit 241a50387b
2 changed files with 9 additions and 1 deletions

View File

@ -60,7 +60,7 @@ class FrostedIce extends Ice{
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 max( //TODO: move this to World
$this->pos->getWorld()->getHighestAdjacentBlockLight($this->pos->x, $this->pos->y, $this->pos->z), $this->pos->getWorld()->getHighestAdjacentBlockLight($this->pos->x, $this->pos->y, $this->pos->z),
$this->pos->getWorld()->getHighestAdjacentBlockSkyLight($this->pos->x, $this->pos->y, $this->pos->z) - $this->pos->getWorld()->getSkyLightReduction() $this->pos->getWorld()->getHighestAdjacentRealBlockSkyLight($this->pos->x, $this->pos->y, $this->pos->z)
) >= 12 - $this->age){ ) >= 12 - $this->age){
if($this->tryMelt()){ if($this->tryMelt()){
foreach($this->getAllSides() as $block){ foreach($this->getAllSides() as $block){

View File

@ -1241,6 +1241,14 @@ class World implements ChunkManager{
return $max; return $max;
} }
/**
* Returns the highest block sky light available in the positions adjacent to the given coordinates, adjusted for
* the world's current time of day and weather conditions.
*/
public function getHighestAdjacentRealBlockSkyLight(int $x, int $y, int $z) : int{
return $this->getHighestAdjacentBlockSkyLight($x, $y, $z) - $this->skyLightReduction;
}
/** /**
* Returns the highest block light level available in the positions adjacent to the specified block coordinates. * Returns the highest block light level available in the positions adjacent to the specified block coordinates.
*/ */