MinimumCostFlowCalculator: fix bug caused by recent change

This commit is contained in:
Dylan K. Taylor 2021-09-18 16:20:01 +01:00
parent 027f7e249b
commit 6b2ab15ea1
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -26,7 +26,7 @@ namespace pocketmine\block\utils;
use pocketmine\block\Block; use pocketmine\block\Block;
use pocketmine\math\Facing; use pocketmine\math\Facing;
use pocketmine\world\World; use pocketmine\world\World;
use function array_fill; use function array_fill_keys;
use function intdiv; use function intdiv;
use function min; use function min;
@ -106,7 +106,7 @@ final class MinimumCostFlowCalculator{
* @return int[] * @return int[]
*/ */
public function getOptimalFlowDirections(int $originX, int $originY, int $originZ) : array{ public function getOptimalFlowDirections(int $originX, int $originY, int $originZ) : array{
$flowCost = array_fill(0, 4, 1000); $flowCost = array_fill_keys(Facing::HORIZONTAL, 1000);
$maxCost = intdiv(4, $this->flowDecayPerBlock); $maxCost = intdiv(4, $this->flowDecayPerBlock);
foreach(Facing::HORIZONTAL as $j){ foreach(Facing::HORIZONTAL as $j){
$x = $originX; $x = $originX;