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>

public class PathJobMoveTowards extends AbstractPathJob implements IDestinationPathJob
Job that handles moving in a direction
  • Field Details

    • target

      protected final net.minecraft.core.BlockPos target
      Position to run to, in order to
    • minDistance

      protected final int minDistance
      Required 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.
      entity - the entity.
      range - max range to search.
  • Method Details

    • computeHeuristic

      protected double computeHeuristic(int x, int y, int z)
      For MoveAwayFromLocation we want our heuristic to weight.
      Specified by:
      computeHeuristic in class AbstractPathJob
      Returns:
      heuristic as a double - Manhatten Distance with tie-breaker.
    • isAtDestination

      protected boolean isAtDestination(@NotNull @NotNull MNode n)
      Checks if the destination has been reached. Meaning that the avoid distance has been reached.
      Specified by:
      isAtDestination in class AbstractPathJob
      Parameters:
      n - Node to test.
      Returns:
      true if so.
    • getDestination

      public net.minecraft.core.BlockPos getDestination()
      Description copied from interface: IDestinationPathJob
      Return the destination
      Specified by:
      getDestination in interface IDestinationPathJob
      Returns:
      destination