mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-15 02:09:42 +00:00
Liquid: eliminate some unnecessary Vector3 field mutations
This commit is contained in:
parent
d38c17835d
commit
42637f97c6
@ -168,7 +168,7 @@ abstract class Liquid extends Transparent{
|
||||
return $this->flowVector;
|
||||
}
|
||||
|
||||
$vector = new Vector3(0, 0, 0);
|
||||
$vX = $vY = $vZ = 0;
|
||||
|
||||
$decay = $this->getEffectiveFlowDecay($this);
|
||||
|
||||
@ -200,20 +200,22 @@ abstract class Liquid extends Transparent{
|
||||
|
||||
if($blockDecay >= 0){
|
||||
$realDecay = $blockDecay - ($decay - 8);
|
||||
$vector->x += ($x - $this->pos->x) * $realDecay;
|
||||
$vector->y += ($y - $this->pos->y) * $realDecay;
|
||||
$vector->z += ($z - $this->pos->z) * $realDecay;
|
||||
$vX += ($x - $this->pos->x) * $realDecay;
|
||||
$vY += ($y - $this->pos->y) * $realDecay;
|
||||
$vZ += ($z - $this->pos->z) * $realDecay;
|
||||
}
|
||||
|
||||
continue;
|
||||
}else{
|
||||
$realDecay = $blockDecay - $decay;
|
||||
$vector->x += ($x - $this->pos->x) * $realDecay;
|
||||
$vector->y += ($y - $this->pos->y) * $realDecay;
|
||||
$vector->z += ($z - $this->pos->z) * $realDecay;
|
||||
$vX += ($x - $this->pos->x) * $realDecay;
|
||||
$vY += ($y - $this->pos->y) * $realDecay;
|
||||
$vZ += ($z - $this->pos->z) * $realDecay;
|
||||
}
|
||||
}
|
||||
|
||||
$vector = new Vector3($vX, $vY, $vZ);
|
||||
|
||||
if($this->falling){
|
||||
if(
|
||||
!$this->canFlowInto($this->pos->getWorldNonNull()->getBlockAt($this->pos->x, $this->pos->y, $this->pos->z - 1)) or
|
||||
|
Loading…
x
Reference in New Issue
Block a user