MinimumCostFlowCalculator
in package
Calculates the path(s) of least resistance for liquid flow.
Table of Contents
- BLOCKED = -1
- CAN_FLOW = 0
- CAN_FLOW_DOWN = 1
- $canFlowInto : Closure
- $flowCostVisited : array<string|int, mixed>
- $flowDecayPerBlock : int
- $world : World
- __construct() : mixed
- getOptimalFlowDirections() : array<string|int, int>
- calculateFlowCost() : int
- canFlowInto() : bool
Constants
BLOCKED
private
mixed
BLOCKED
= -1
CAN_FLOW
private
mixed
CAN_FLOW
= 0
CAN_FLOW_DOWN
private
mixed
CAN_FLOW_DOWN
= 1
Properties
$canFlowInto
private
Closure
$canFlowInto
$flowCostVisited
private
array<string|int, mixed>
$flowCostVisited
= []
$flowDecayPerBlock
private
int
$flowDecayPerBlock
$world
private
World
$world
Methods
__construct()
public
__construct(World $world, int $flowDecayPerBlock, Closure $canFlowInto) : mixed
Parameters
- $world : World
- $flowDecayPerBlock : int
- $canFlowInto : Closure
Tags
Return values
mixed —getOptimalFlowDirections()
public
getOptimalFlowDirections(int $originX, int $originY, int $originZ) : array<string|int, int>
Parameters
- $originX : int
- $originY : int
- $originZ : int
Return values
array<string|int, int> —calculateFlowCost()
private
calculateFlowCost(int $blockX, int $blockY, int $blockZ, int $accumulatedCost, int $maxCost, int $originOpposite, int $lastOpposite) : int
Parameters
- $blockX : int
- $blockY : int
- $blockZ : int
- $accumulatedCost : int
- $maxCost : int
- $originOpposite : int
- $lastOpposite : int
Return values
int —canFlowInto()
private
canFlowInto(Block $block) : bool
Parameters
- $block : Block