Class PathJobWalkRandomEdge

java.lang.Object
com.minecolonies.core.entity.pathfinding.pathjobs.AbstractPathJob
com.minecolonies.core.entity.pathfinding.pathjobs.PathJobWalkRandomEdge
All Implemented Interfaces:
IPathJob, ISearchPathJob, Callable<net.minecraft.world.level.pathfinder.Path>

public class PathJobWalkRandomEdge extends AbstractPathJob implements ISearchPathJob
Walks to a random edge block nearby, a block next to air. Does not use ladders
  • Constructor Details

    • PathJobWalkRandomEdge

      public PathJobWalkRandomEdge(net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraft.core.BlockPos searchAroundPos, int range, net.minecraft.world.entity.Mob entity)
  • Method Details

    • computeHeuristic

      protected double computeHeuristic(int x, int y, int z)
      Description copied from class: AbstractPathJob
      Compute the heuristic cost ('h' value) of a given position x,y,z.

      Returning a value of 0 performs a breadth-first search. Returning a value less than actual possible cost to goal guarantees shortest path, but at computational expense. Returning a value exactly equal to the cost to the goal guarantees shortest path and least expense (but generally. only works when path is straight and unblocked). Returning a value greater than the actual cost to goal produces good, but not perfect paths, and is fast. Returning a very high value (such that 'h' is very high relative to 'g') then only 'h' (the heuristic) matters as the search will be a very fast greedy best-first-search, ignoring cost weighting and distance.

      Specified by:
      computeHeuristic in class AbstractPathJob
      Returns:
      the heuristic.
    • setPathingOptions

      public void setPathingOptions(PathingOptions pathingOptions)
      Description copied from class: AbstractPathJob
      Sets the pathing options
      Overrides:
      setPathingOptions in class AbstractPathJob
      Parameters:
      pathingOptions - the pathing options to set.
    • isAtDestination

      protected boolean isAtDestination(MNode n)
      Description copied from class: AbstractPathJob
      Return true if the given node is a viable final destination, and the path should generate to here.
      Specified by:
      isAtDestination in class AbstractPathJob
      Parameters:
      n - Node to test.
      Returns:
      true if the node is a viable destination.
    • getEndNodeScore

      public double getEndNodeScore(MNode n)
      Description copied from class: AbstractPathJob
      Calculates a score for potential points where the path may end given no destination By default the heuristic for the closest node is used
      Specified by:
      getEndNodeScore in interface ISearchPathJob
      Overrides:
      getEndNodeScore in class AbstractPathJob
      Parameters:
      n - Node to test.
      Returns:
      score for the node, lower is better