A WIP PocketMine Pathfinder
- AStar pathfinding
- Pathfinding can be divided into several ticks
- Set costs for various blocks
- Navigator for entities
- Create an AStar-Object
$aStar = new AStar(World $world, Vector3 $startVector3, Vector3 $targetVector3, ?AxisAlignedBB $axisAlignedBB, ?AlgorithmSettings $settings);- Configure settings (See AlgorithmSettings-Class for all available methods)
$aStar->getSettings()
->setTimeout(0.5)
->setMaxTicks(10);
...- Start and get pathfinding result
$aStar->then(function(?PathResult $pathResult): void {
if($pathResult === null) {
echo "No path found!";
return;
}
echo "Path found!";
})->start();This pathfinder is not the best, but you can help to improve it. If you see code places that can be improved or any method/variable names that don't fit, please create a pull request with the respective changes.
Twitter
Discord: Matze#1754