java.lang.Object
com.minecolonies.core.entity.pathfinding.pathresults.PathResult<T>
Direct Known Subclasses:
TreePathResult, WaterPathResult

public class PathResult<T extends AbstractPathJob> extends Object
Creates a pathResult of a certain path.
  • Field Details

    • status

      protected PathFindingStatus status
      The pathfinding status
    • costPerDist

      public double costPerDist
      Cost per distance traveled factor, only if path reaches
    • searchedNodes

      public int searchedNodes
      Amount of searched nodes
  • Constructor Details

    • PathResult

      public PathResult()
  • Method Details

    • getStatus

      public PathFindingStatus getStatus()
      Get Status of the Path.
      Returns:
      status.
    • setStatus

      public void setStatus(PathFindingStatus s)
      For PathNavigate and AbstractPathJob use only.
      Parameters:
      s - status to set.
    • isInProgress

      public boolean isInProgress()
      Returns:
      true if the path is still computing or being followed.
    • isComputing

      public boolean isComputing()
    • failedToReachDestination

      public boolean failedToReachDestination()
      Returns:
      true if the no path can be found.
    • isPathReachingDestination

      public boolean isPathReachingDestination()
      Returns:
      true if the path is computed, and it reaches a desired destination.
    • setPathReachesDestination

      public void setPathReachesDestination(boolean value)
      For PathNavigate and AbstractPathJob use only.
      Parameters:
      value - new value for pathReachesDestination.
    • isCancelled

      public boolean isCancelled()
      Returns:
      true if the path was cancelled before being computed or before the entity reached it's destination.
    • getPathLength

      public int getPathLength()
      Returns:
      length of the compute path, in nodes.
    • hasPath

      public boolean hasPath()
      Returns:
      true if the path moves from the current location, useful for checking if a path actually generated.
    • getPath

      @Nullable public @Nullable net.minecraft.world.level.pathfinder.Path getPath()
      Get the generated path or null
      Returns:
      path
    • getJob

      public T getJob()
      Get the queried job for the pathresult
      Returns:
    • setJob

      public void setJob(T job)
      Set the job for this result
      Parameters:
      job -
    • addTrackingPlayer

      public void addTrackingPlayer(UUID uuid)
      Adds another player to the debug tracking
      Parameters:
      uuid - player ID
    • startJob

      public void startJob(ExecutorService executorService)
      Starts the job by queing it to an executor
      Parameters:
      executorService - executor
    • processCalculationResults

      public void processCalculationResults()
      Processes the completed calculation results
    • isCalculatingPath

      public boolean isCalculatingPath()
      Check if we're calculating the pathfinding currently
      Returns:
      true
    • isDone

      public boolean isDone()
      Whether the path calculation finished and was processed
      Returns:
      true if calculation is done and processed
    • cancel

      public void cancel()
      Cancels the path calculation
    • getDebugWatchers

      public List<net.minecraft.server.level.ServerPlayer> getDebugWatchers()
      Gets the tracking players
      Returns: