Class PathJobRaiderPathing

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

public class PathJobRaiderPathing extends AbstractPathJob implements IDestinationPathJob
Special raider pathfinding, can go through blocks and place ladders, is finished when reaching close to the intended spawn and is a legit spawn point.
  • Constructor Details

    • PathJobRaiderPathing

      public PathJobRaiderPathing(List<IBuilding> buildings, net.minecraft.world.level.Level world, @NotNull @NotNull net.minecraft.core.BlockPos start, net.minecraft.core.BlockPos targetSpawnPoint)
  • 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.
    • 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.
    • isPassable

      protected boolean isPassable(int x, int y, int z, boolean head, MNode currentnode)
      Description copied from class: AbstractPathJob
      Checks passability
      Overrides:
      isPassable in class AbstractPathJob
      Parameters:
      x -
      y -
      z -
      head -
      currentnode -
      Returns:
    • visitNode

      protected void visitNode(MNode node)
      Description copied from class: AbstractPathJob
      Visits the given node and explores neighbours
      Overrides:
      visitNode in class AbstractPathJob
      Parameters:
      node -
    • getGroundHeight

      protected int getGroundHeight(MNode parent, int x, int y, int z)
      Description copied from class: AbstractPathJob
      Get the height of the ground at the given x,z coordinate, within 1 step of y.
      Overrides:
      getGroundHeight in class AbstractPathJob
      Parameters:
      parent - parent node.
      Returns:
      y height of first open, viable block above ground, or -1 if blocked or too far a drop.
    • modifyCost

      protected double modifyCost(double cost, MNode parent, boolean swimstart, boolean swimming, int x, int y, int z, net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.state.BlockState below)
      Description copied from class: AbstractPathJob
      Modifies costs if needed for a node
      Overrides:
      modifyCost in class AbstractPathJob
      Parameters:
      cost -
      parent -
      swimstart -
      swimming -
      state -
      Returns:
    • getDestination

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