Class VectorGoal

java.lang.Object
net.citizensnpcs.api.astar.pathfinder.VectorGoal
All Implemented Interfaces:
AStarGoal<VectorNode>

public class VectorGoal extends Object implements AStarGoal<VectorNode>
  • Constructor Details

    • VectorGoal

      public VectorGoal(Location dest, float range)
  • Method Details

    • g

      public float g(VectorNode from, VectorNode to)
      Description copied from interface: AStarGoal
      Returns the cost of moving between the two supplied AStarNodes.
      Specified by:
      g in interface AStarGoal<VectorNode>
      Parameters:
      from - The node to start from
      to - The end node
      Returns:
      The cost
    • getGoalVector

      public Vector getGoalVector()
    • getInitialCost

      public float getInitialCost(VectorNode node)
      Description copied from interface: AStarGoal
      Returns the initial cost value when starting from the supplied AStarNode. This represents an initial estimate for reaching the goal state from the start node.
      Specified by:
      getInitialCost in interface AStarGoal<VectorNode>
      Parameters:
      node - The start node
      Returns:
      The initial cost
    • h

      public float h(VectorNode from)
      Description copied from interface: AStarGoal
      Returns the estimated heuristic cost of traversing from the supplied AStarNode to the goal.
      Specified by:
      h in interface AStarGoal<VectorNode>
      Parameters:
      from - The start node
      Returns:
      The heuristic cost
    • isFinished

      public boolean isFinished(VectorNode node)
      Description copied from interface: AStarGoal
      Returns whether the supplied AStarNode represents the goal state for this AStarGoal. This will halt execution of the calling AStarMachine.
      Specified by:
      isFinished in interface AStarGoal<VectorNode>
      Parameters:
      node - The node to check
      Returns:
      Whether the node is the goal state