World: don't assume that random Vector3 are int vectors

we can safely assume this for blocks (though the type info doesn't reflect it) but this is not safe to assume for random APIs that might be used by plugins.
This commit is contained in:
Dylan K. Taylor
2023-11-06 17:15:17 +00:00
parent bbe66e8e09
commit d09af2e30d
3 changed files with 24 additions and 18 deletions

View File

@ -1670,7 +1670,10 @@ class World implements ChunkManager{
* time of day.
*/
public function getFullLight(Vector3 $pos) : int{
return $this->getFullLightAt($pos->x, $pos->y, $pos->z);
$floorX = $pos->getFloorX();
$floorY = $pos->getFloorY();
$floorZ = $pos->getFloorZ();
return $this->getFullLightAt($floorX, $floorY, $floorZ);
}
/**
@ -1699,7 +1702,10 @@ class World implements ChunkManager{
* 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);
$floorX = $pos->getFloorX();
$floorY = $pos->getFloorY();
$floorZ = $pos->getFloorZ();
return $this->getPotentialLightAt($floorX, $floorY, $floorZ);
}
/**