Liquid: use facing instead of hardcoded integers

This commit is contained in:
Dylan K. Taylor 2021-09-19 15:37:03 +01:00
parent 576c33ee8f
commit 18de35ffc7
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -177,21 +177,17 @@ abstract class Liquid extends Transparent{
$world = $this->position->getWorld(); $world = $this->position->getWorld();
for($j = 0; $j < 4; ++$j){ foreach(Facing::HORIZONTAL as $j){
$x = $this->position->x; $x = $this->position->x;
$y = $this->position->y; $y = $this->position->y;
$z = $this->position->z; $z = $this->position->z;
if($j === 0){ match($j){
--$x; Facing::WEST => --$x,
}elseif($j === 1){ Facing::EAST => ++$x,
++$x; Facing::NORTH => --$z,
}elseif($j === 2){ Facing::SOUTH => ++$z
--$z; };
}elseif($j === 3){
++$z;
}
$sideBlock = $world->getBlockAt($x, $y, $z); $sideBlock = $world->getBlockAt($x, $y, $z);
$blockDecay = $this->getEffectiveFlowDecay($sideBlock); $blockDecay = $this->getEffectiveFlowDecay($sideBlock);