private function getOptimalFlowDirections()
{
if ($this->temporalVector === \null) {
$this->temporalVector = new Vector3(0, 0, 0);
}
for ($j = 0; $j < 4; ++$j) {
$this->flowCost[$j] = 1000;
$x = $this->x;
$y = $this->y;
$z = $this->z;
if ($j === 0) {
--$x;
} elseif ($j === 1) {
++$x;
} elseif ($j === 2) {
--$z;
} elseif ($j === 3) {
++$z;
}
$block = $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $z));
if (!$block->canBeFlowedInto() and !$block instanceof Liquid) {
continue;
} elseif ($block instanceof Liquid and $block->getDamage() === 0) {
continue;
} elseif ($this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y - 1, $z))->canBeFlowedInto()) {
$this->flowCost[$j] = 0;
} else {
$this->flowCost[$j] = $this->calculateFlowCost($block, 1, $j);
}
}
$minCost = $this->flowCost[0];
for ($i = 1; $i < 4; ++$i) {
if ($this->flowCost[$i] < $minCost) {
$minCost = $this->flowCost[$i];
}
}
for ($i = 0; $i < 4; ++$i) {
$this->isOptimalFlowDirection[$i] = $this->flowCost[$i] === $minCost;
}
return $this->isOptimalFlowDirection;
}