mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 02:38:54 +00:00
Liquid: make getFlowVector() slightly less cancerous to read
This commit is contained in:
parent
19bc879dc1
commit
3e21e47b7a
@ -172,6 +172,8 @@ abstract class Liquid extends Transparent{
|
||||
|
||||
$decay = $this->getEffectiveFlowDecay($this);
|
||||
|
||||
$world = $this->pos->getWorld();
|
||||
|
||||
for($j = 0; $j < 4; ++$j){
|
||||
|
||||
$x = $this->pos->x;
|
||||
@ -188,7 +190,7 @@ abstract class Liquid extends Transparent{
|
||||
++$z;
|
||||
}
|
||||
|
||||
$sideBlock = $this->pos->getWorld()->getBlockAt($x, $y, $z);
|
||||
$sideBlock = $world->getBlockAt($x, $y, $z);
|
||||
$blockDecay = $this->getEffectiveFlowDecay($sideBlock);
|
||||
|
||||
if($blockDecay < 0){
|
||||
@ -196,7 +198,7 @@ abstract class Liquid extends Transparent{
|
||||
continue;
|
||||
}
|
||||
|
||||
$blockDecay = $this->getEffectiveFlowDecay($this->pos->getWorld()->getBlockAt($x, $y - 1, $z));
|
||||
$blockDecay = $this->getEffectiveFlowDecay($world->getBlockAt($x, $y - 1, $z));
|
||||
|
||||
if($blockDecay >= 0){
|
||||
$realDecay = $blockDecay - ($decay - 8);
|
||||
@ -218,14 +220,14 @@ abstract class Liquid extends Transparent{
|
||||
|
||||
if($this->falling){
|
||||
if(
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y, $this->pos->z - 1)) or
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y, $this->pos->z + 1)) or
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x - 1, $this->pos->y, $this->pos->z)) or
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x + 1, $this->pos->y, $this->pos->z)) or
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y + 1, $this->pos->z - 1)) or
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x, $this->pos->y + 1, $this->pos->z + 1)) or
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x - 1, $this->pos->y + 1, $this->pos->z)) or
|
||||
!$this->canFlowInto($this->pos->getWorld()->getBlockAt($this->pos->x + 1, $this->pos->y + 1, $this->pos->z))
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x, $this->pos->y, $this->pos->z - 1)) or
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x, $this->pos->y, $this->pos->z + 1)) or
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x - 1, $this->pos->y, $this->pos->z)) or
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x + 1, $this->pos->y, $this->pos->z)) or
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x, $this->pos->y + 1, $this->pos->z - 1)) or
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x, $this->pos->y + 1, $this->pos->z + 1)) or
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x - 1, $this->pos->y + 1, $this->pos->z)) or
|
||||
!$this->canFlowInto($world->getBlockAt($this->pos->x + 1, $this->pos->y + 1, $this->pos->z))
|
||||
){
|
||||
$vector = $vector->normalize()->add(0, -6, 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user