mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Liquid: Update legacy code with Facing::OFFSET
This commit is contained in:
parent
114f444ec3
commit
f868c1d8c6
@ -170,16 +170,11 @@ abstract class Liquid extends Transparent{
|
||||
$world = $this->position->getWorld();
|
||||
|
||||
foreach(Facing::HORIZONTAL as $j){
|
||||
$x = $this->position->x;
|
||||
$y = $this->position->y;
|
||||
$z = $this->position->z;
|
||||
[$dx, $dy, $dz] = Facing::OFFSET[$j];
|
||||
|
||||
match($j){
|
||||
Facing::WEST => --$x,
|
||||
Facing::EAST => ++$x,
|
||||
Facing::NORTH => --$z,
|
||||
Facing::SOUTH => ++$z
|
||||
};
|
||||
$x = $this->position->x + $dx;
|
||||
$y = $this->position->y + $dy;
|
||||
$z = $this->position->z + $dz;
|
||||
|
||||
$sideBlock = $world->getBlockAt($x, $y, $z);
|
||||
$blockDecay = $this->getEffectiveFlowDecay($sideBlock);
|
||||
|
@ -58,17 +58,10 @@ final class MinimumCostFlowCalculator{
|
||||
if($j === $originOpposite || $j === $lastOpposite){
|
||||
continue;
|
||||
}
|
||||
|
||||
$x = $blockX;
|
||||
$y = $blockY;
|
||||
$z = $blockZ;
|
||||
|
||||
match($j){
|
||||
Facing::WEST => --$x,
|
||||
Facing::EAST => ++$x,
|
||||
Facing::NORTH => --$z,
|
||||
Facing::SOUTH => ++$z
|
||||
};
|
||||
[$dx, $dy, $dz] = Facing::OFFSET[$j];
|
||||
$x = $blockX + $dx;
|
||||
$y = $blockY + $dy;
|
||||
$z = $blockZ + $dz;
|
||||
|
||||
if(!isset($this->flowCostVisited[$hash = World::blockHash($x, $y, $z)])){
|
||||
if(!$this->world->isInWorld($x, $y, $z) || !$this->canFlowInto($this->world->getBlockAt($x, $y, $z))){
|
||||
@ -109,16 +102,10 @@ final class MinimumCostFlowCalculator{
|
||||
$flowCost = array_fill_keys(Facing::HORIZONTAL, 1000);
|
||||
$maxCost = intdiv(4, $this->flowDecayPerBlock);
|
||||
foreach(Facing::HORIZONTAL as $j){
|
||||
$x = $originX;
|
||||
$y = $originY;
|
||||
$z = $originZ;
|
||||
|
||||
match($j){
|
||||
Facing::WEST => --$x,
|
||||
Facing::EAST => ++$x,
|
||||
Facing::NORTH => --$z,
|
||||
Facing::SOUTH => ++$z
|
||||
};
|
||||
[$dx, $dy, $dz] = Facing::OFFSET[$j];
|
||||
$x = $originX + $dx;
|
||||
$y = $originY + $dy;
|
||||
$z = $originZ + $dz;
|
||||
|
||||
if(!$this->world->isInWorld($x, $y, $z) || !$this->canFlowInto($this->world->getBlockAt($x, $y, $z))){
|
||||
$this->flowCostVisited[World::blockHash($x, $y, $z)] = self::BLOCKED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user