Fixed behavioural change on invalid Facing introduced by previous commit

while this shouldn't be given invalid facings anyway, Vector3::getSide() accepts them and just returns itself.
This commit is contained in:
Dylan K. Taylor 2023-10-19 13:27:44 +01:00
parent 6a3ec70c72
commit 19a1792184
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -749,7 +749,7 @@ class Block{
public function getSide(int $side, int $step = 1){
$position = $this->position;
if($position->isValid()){
[$dx, $dy, $dz] = Facing::OFFSET[$side] ?? throw new \InvalidArgumentException("Unknown side $side");
[$dx, $dy, $dz] = Facing::OFFSET[$side] ?? [0, 0, 0];
return $position->getWorld()->getBlockAt(
$position->x + ($dx * $step),
$position->y + ($dy * $step),