Liquid: fix max cost calculation for flow direction search, closes #2995

This commit is contained in:
Dylan K. Taylor 2019-07-07 14:32:52 +01:00
parent 77a4393c7b
commit 11fc16617a

View File

@ -32,6 +32,7 @@ use pocketmine\level\sound\FizzSound;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use function array_fill;
use function intdiv;
use function lcg_value;
use function min;
@ -372,7 +373,7 @@ abstract class Liquid extends Transparent{
*/
private function getOptimalFlowDirections() : array{
$flowCost = array_fill(0, 4, 1000);
$maxCost = 4 / $this->getFlowDecayPerBlock();
$maxCost = intdiv(4, $this->getFlowDecayPerBlock());
for($j = 0; $j < 4; ++$j){
$x = $this->x;
$y = $this->y;