Class PathJobMoveTowards
java.lang.Object
com.minecolonies.core.entity.pathfinding.pathjobs.AbstractPathJob
com.minecolonies.core.entity.pathfinding.pathjobs.PathJobMoveTowards
- All Implemented Interfaces:
IPathJob,IDestinationPathJob,Callable<net.minecraft.world.level.pathfinder.Path>
Job that handles moving in a direction
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intRequired avoidDistance.protected final net.minecraft.core.BlockPosPosition to run to, in order toFields inherited from class com.minecolonies.core.entity.pathfinding.pathjobs.AbstractPathJob
cachedBlockLookup, debugDrawEnabled, debugNodesExtra, debugNodesNotVisited, debugNodesOrgPath, debugNodesPath, debugNodesVisited, debugNodesVisitedLater, entity, extraNodes, heuristicMod, MAX_NODES, maxNodes, result, start, tempWorldPos, totalNodesVisited, world -
Constructor Summary
ConstructorsConstructorDescriptionPathJobMoveTowards(net.minecraft.world.level.Level world, @NotNull net.minecraft.core.BlockPos start, @NotNull net.minecraft.core.BlockPos direction, int minDistance, net.minecraft.world.entity.Mob entity) Prepares the PathJob for the path finding system. -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecomputeHeuristic(int x, int y, int z) For MoveAwayFromLocation we want our heuristic to weight.net.minecraft.core.BlockPosReturn the destinationprotected booleanisAtDestination(@NotNull MNode n) Checks if the destination has been reached.Methods inherited from class com.minecolonies.core.entity.pathfinding.pathjobs.AbstractPathJob
call, computeCost, exploreInDirection, getActualWorld, getEndNodeScore, getEntity, getGroundHeight, getPathingOptions, getResult, getStart, handleDebugOptions, initDebug, isPassable, isPassable, modifyCost, search, setPathingOptions, stopOnNodeLimit, syncDebug, toString, visitNode
-
Field Details
-
target
protected final net.minecraft.core.BlockPos targetPosition to run to, in order to -
minDistance
protected final int minDistanceRequired avoidDistance.
-
-
Constructor Details
-
PathJobMoveTowards
public PathJobMoveTowards(net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraft.core.BlockPos start, @NotNull @NotNull net.minecraft.core.BlockPos direction, int minDistance, net.minecraft.world.entity.Mob entity) Prepares the PathJob for the path finding system.- Parameters:
world- world the entity is in.start- starting location.direction- location to avoid.minDistance- how far to move away.range- max range to search.entity- the entity.
-
-
Method Details
-
computeHeuristic
protected double computeHeuristic(int x, int y, int z) For MoveAwayFromLocation we want our heuristic to weight.- Specified by:
computeHeuristicin classAbstractPathJob- Returns:
- heuristic as a double - Manhatten Distance with tie-breaker.
-
isAtDestination
Checks if the destination has been reached. Meaning that the avoid distance has been reached.- Specified by:
isAtDestinationin classAbstractPathJob- Parameters:
n- Node to test.- Returns:
- true if so.
-
getDestination
public net.minecraft.core.BlockPos getDestination()Description copied from interface:IDestinationPathJobReturn the destination- Specified by:
getDestinationin interfaceIDestinationPathJob- Returns:
- destination
-