Class PathJobEscapeWater

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

public class PathJobEscapeWater extends AbstractPathJob implements IDestinationPathJob
Job that handles moving away from something.
  • Field Details

    • avoid

      @NotNull protected final @NotNull net.minecraft.core.BlockPos avoid
      Position to run to, in order to avoid something.
  • Constructor Details

    • PathJobEscapeWater

      public PathJobEscapeWater(net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraft.core.BlockPos start, int range, net.minecraft.world.entity.Mob entity)
      Prepares the PathJob for the path finding system.
      Parameters:
      world - world the entity is in.
      start - starting location.
      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:
      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.
    • 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.
    • getDestination

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