Crops must have access to a light level of at least 9

This commit is contained in:
Dylan K. Taylor
2023-11-06 16:02:57 +00:00
parent d3b7861d1a
commit 457660235e
2 changed files with 41 additions and 9 deletions

View File

@ -1666,16 +1666,16 @@ class World implements ChunkManager{
}
/**
* Returns the highest available level of any type of light at the given coordinates, adjusted for the current
* weather and time of day.
* Returns the highest level of any type of light at the given coordinates, adjusted for the current weather and
* time of day.
*/
public function getFullLight(Vector3 $pos) : int{
return $this->getFullLightAt($pos->x, $pos->y, $pos->z);
}
/**
* Returns the highest available level of any type of light at the given coordinates, adjusted for the current
* weather and time of day.
* Returns the highest level of any type of light at the given coordinates, adjusted for the current weather and
* time of day.
*/
public function getFullLightAt(int $x, int $y, int $z) : int{
$skyLight = $this->getRealBlockSkyLightAt($x, $y, $z);
@ -1687,18 +1687,40 @@ 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.
* Returns the highest 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, $this->getFullLightAt(...));
}
/**
* Returns the highest potential level of any type of light at the target coordinates.
* This is not affected by weather or time of day.
*/
public function getPotentialLight(Vector3 $pos) : int{
return $this->getPotentialLightAt($pos->x, $pos->y, $pos->z);
}
/**
* Returns the highest potential level of any type of light at the target coordinates.
* This is not affected by weather or time of day.
*/
public function getPotentialLightAt(int $x, int $y, int $z) : int{
return max($this->getPotentialBlockSkyLightAt($x, $y, $z), $this->getBlockLightAt($x, $y, $z));
}
/**
* Returns the highest potential level of any type of light at, or adjacent to, the given coordinates.
* This is not affected by weather or time of day.
*/
public function getHighestAdjacentPotentialLightAt(int $x, int $y, int $z) : int{
return $this->getHighestAdjacentLight($x, $y, $z, $this->getPotentialLightAt(...));
}
/**
* Returns the highest potential level of sky light at the target coordinates, regardless of the time of day or
* weather conditions.
* You usually don't want to use this for vanilla gameplay logic; prefer the real sky light instead.
* @see World::getRealBlockSkyLightAt()
*
* @return int 0-15
*/