Class PathResult<T extends AbstractPathJob>
java.lang.Object
com.minecolonies.core.entity.pathfinding.pathresults.PathResult<T>
- Direct Known Subclasses:
TreePathResult,WaterPathResult
Creates a pathResult of a certain path.
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleCost per distance traveled factor, only if path reachesintAmount of searched nodesprotected PathFindingStatusThe pathfinding status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTrackingPlayer(UUID uuid) Adds another player to the debug trackingvoidcancel()Cancels the path calculationbooleanList<net.minecraft.server.level.ServerPlayer>Gets the tracking playersgetJob()Get the queried job for the pathresult@Nullable net.minecraft.world.level.pathfinder.PathgetPath()Get the generated path or nullintGet Status of the Path.booleanhasPath()booleanCheck if we're calculating the pathfinding currentlybooleanbooleanbooleanisDone()Whether the path calculation finished and was processedbooleanbooleanvoidProcesses the completed calculation resultsvoidSet the job for this resultvoidsetPathReachesDestination(boolean value) For PathNavigate and AbstractPathJob use only.voidFor PathNavigate and AbstractPathJob use only.voidstartJob(ExecutorService executorService) Starts the job by queing it to an executor
-
Field Details
-
status
The pathfinding status -
costPerDist
public double costPerDistCost per distance traveled factor, only if path reaches -
searchedNodes
public int searchedNodesAmount of searched nodes
-
-
Constructor Details
-
PathResult
public PathResult()
-
-
Method Details
-
getStatus
Get Status of the Path.- Returns:
- status.
-
setStatus
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
Get the queried job for the pathresult- Returns:
-
setJob
Set the job for this result- Parameters:
job-
-
addTrackingPlayer
Adds another player to the debug tracking- Parameters:
uuid- player ID
-
startJob
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
Gets the tracking players- Returns:
-