
MS扩展内容
此模组是一个通用寻路API
本模组被设计为供 Minescript 等脚本模组使用的 API。
如何使用
(Minescript 示例)
from minescript import echo
# 导入 API
PathfinderAPI = JavaClass("gamchu.pathfinder.api.PathfinderAPI")
GoalBlock = JavaClass("gamchu.pathfinder.goals.GoalBlock")
# 获取 pathfinder 实例
pathfinder = PathfinderAPI.getProvider().getPathfinder()
# 创建一个目标并寻找平滑路径
goal = GoalBlock(100, 64, 200)
future = pathfinder.findSmoothedPathAsync(goal)
# 等待结果
result = future.get()
if result.getSuccess():
echo(f"Path found with {result.getPathSize()} waypoints")
else:
echo("No path found")
检查寻路状态
# 检查寻路当前是否正在运行
if pathfinder.isPathing():
echo("Pathfinding in progress...")
else:
echo("No pathfinding running")
取消寻路
# 取消当前的寻路操作
if pathfinder.isPathing():
pathfinder.cancel()
echo("Pathfinding cancelled")
正在加载版本记录…
正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。