Class SimpleRouteFinder

java.lang.Object
cn.nukkit.entity.ai.route.finder.SimpleRouteFinder
All Implemented Interfaces:
IRouteFinder
Direct Known Subclasses:
ConcurrentRouteFinder, SimpleFlatAStarRouteFinder

@PowerNukkitXOnly @Since("1.6.0.0-PNX") public abstract class SimpleRouteFinder extends Object implements IRouteFinder
非异步的路径查找抽象类
在PowerNukkitX的生物AI架构中,不同实体的路径查找是并行的而不是异步的
所以说我们并不需要异步路径查找
  • Field Details

    • nodes

      protected List<Node> nodes
    • currentIndex

      protected int currentIndex
    • evalPos

      protected IPosEvaluator evalPos
  • Constructor Details

    • SimpleRouteFinder

      public SimpleRouteFinder(IPosEvaluator blockEvaluator)
  • Method Details

    • addNode

      protected void addNode(Node node)
    • addNode

      protected void addNode(List<Node> node)
    • resetNodes

      protected void resetNodes()
    • getRoute

      public List<Node> getRoute()
      Description copied from interface: IRouteFinder
      获取寻路结果
      Specified by:
      getRoute in interface IRouteFinder
      Returns:
      一个包含 Node 的列表 List,应已排序好,第一项为寻路起点,最后一项为寻路终点,之间的为找到的路径点
    • getCurrentNode

      @Nullable public Node getCurrentNode()
      Specified by:
      getCurrentNode in interface IRouteFinder
      Returns:
      当前索引位置对应的节点 Node
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface IRouteFinder
      Returns:
      是否有下一个节点 Node
    • next

      @Nullable public Node next()
      Description copied from interface: IRouteFinder
      获取下一个节点Node(如果有的话)
      Specified by:
      next in interface IRouteFinder
      Returns:
      下一个节点
    • hasCurrentNode

      public boolean hasCurrentNode()
      Specified by:
      hasCurrentNode in interface IRouteFinder
      Returns:
      当前索引所在位置是否有节点 Node
    • getNodeIndex

      public int getNodeIndex()
      Specified by:
      getNodeIndex in interface IRouteFinder
      Returns:
      当前索引
    • setNodeIndex

      public void setNodeIndex(int index)
      Description copied from interface: IRouteFinder
      设置当前索引
      Specified by:
      setNodeIndex in interface IRouteFinder
      Parameters:
      index - 索引值
    • getNode

      @Nullable public Node getNode(int index)
      Specified by:
      getNode in interface IRouteFinder
      Returns:
      指定索引位置的节点 Node
    • getNodes

      public List<Node> getNodes()
    • getCurrentIndex

      public int getCurrentIndex()
    • getEvalPos

      public IPosEvaluator getEvalPos()