Class PathfindingUtils

java.lang.Object
com.minecolonies.core.entity.pathfinding.PathfindingUtils

public class PathfindingUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Map<String,UUID>
    Map for tracking specific path types, type to player uuid
    static final Map<UUID,UUID>
    Which citizens are being tracked by which players.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    hasAnyCollisionAlong(int startX, int startY, int startZ, int endX, int endY, int endZ, CachingBlockLookup blockLookup)
    Checks for collisions along a line between two given positions
    static boolean
    isDangerous(net.minecraft.world.level.block.state.BlockState blockState)
    Is the surface inherently dangerous to stand on/in (i.e.
    static boolean
    isLadder(net.minecraft.world.level.block.state.BlockState blockState, @Nullable PathingOptions options)
    Checks if the given state is a ladder, or if pathing options allow a different type of climbable
    static boolean
    isLadder(net.minecraft.world.level.block.state.BlockState state, PathingOptions options, int nextX, int nextY, int nextZ, CachingBlockLookup cachedBlockLookup)
     
    static boolean
    isLava(@NotNull net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.block.state.BlockState pState, @Nullable net.minecraft.world.level.material.FluidState pFluidState)
    Check if the block at this position is lava.
    static boolean
    isLiquid(net.minecraft.world.level.block.state.BlockState state)
    Check if this is a liquid state for swimming.
    static boolean
    isWater(@NotNull net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos)
    Check if the block at this position is actually some kind of waterly fluid.
    static boolean
    isWater(@NotNull net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, @Nullable net.minecraft.world.level.block.state.BlockState pState, @Nullable net.minecraft.world.level.material.FluidState pFluidState)
    Check if the block at this position is actually some kind of waterly fluid.
    static net.minecraft.core.BlockPos
    prepareStart(@NotNull net.minecraft.world.entity.LivingEntity entity)
    Generates a good path starting location for the entity to path from, correcting for the following conditions.
    static void
    setLadderFacing(@NotNull net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, @NotNull PathPointExtended p)
    Sets the direction where the ladder is facing.
    static void
    syncDebugReachedPositions(net.minecraft.core.BlockPos reached, List<net.minecraft.server.level.ServerPlayer> players)
    Set the set of reached blocks to the client.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • trackingMap

      public static final Map<UUID,UUID> trackingMap
      Which citizens are being tracked by which players. Player to entity uuid
    • trackByType

      public static final Map<String,UUID> trackByType
      Map for tracking specific path types, type to player uuid
  • Constructor Details

    • PathfindingUtils

      public PathfindingUtils()
  • Method Details

    • syncDebugReachedPositions

      public static void syncDebugReachedPositions(net.minecraft.core.BlockPos reached, List<net.minecraft.server.level.ServerPlayer> players)
      Set the set of reached blocks to the client.
      Parameters:
      reached - the reached blocks.
      players - the tracking players.
    • prepareStart

      public static net.minecraft.core.BlockPos prepareStart(@NotNull @NotNull net.minecraft.world.entity.LivingEntity entity)
      Generates a good path starting location for the entity to path from, correcting for the following conditions. - Being in water: pathfinding in water occurs along the surface; adjusts position to surface. - Being in a fence space: finds correct adjacent position which is not a fence space, to prevent starting path. from within the fence block.
      Parameters:
      entity - Entity for the pathfinding operation.
      Returns:
      ChunkCoordinates for starting location.
    • setLadderFacing

      public static void setLadderFacing(@NotNull @NotNull net.minecraft.world.level.LevelReader world, net.minecraft.core.BlockPos pos, @NotNull @NotNull PathPointExtended p)
      Sets the direction where the ladder is facing.
      Parameters:
      world - the world in.
      pos - the position.
      p - the path.
    • isLiquid

      public static boolean isLiquid(net.minecraft.world.level.block.state.BlockState state)
      Check if this is a liquid state for swimming.
      Parameters:
      state - the state to check.
      Returns:
      true if so.
    • isWater

      public static boolean isWater(@NotNull @NotNull net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos)
      Check if the block at this position is actually some kind of waterly fluid.
      Parameters:
      pos - the pos in the world.
      Returns:
      true if so.
    • isWater

      public static boolean isWater(@NotNull @NotNull net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.world.level.block.state.BlockState pState, @Nullable @Nullable net.minecraft.world.level.material.FluidState pFluidState)
      Check if the block at this position is actually some kind of waterly fluid.
      Parameters:
      pos - the pos in the world.
      pState - existing blockstate or null
      pFluidState - existing fluidstate or null
      Returns:
      true if so.
    • isLava

      public static boolean isLava(@NotNull @NotNull net.minecraft.world.level.BlockGetter world, net.minecraft.core.BlockPos pos, @Nullable @Nullable net.minecraft.world.level.block.state.BlockState pState, @Nullable @Nullable net.minecraft.world.level.material.FluidState pFluidState)
      Check if the block at this position is lava.
      Parameters:
      pos - the pos in the world.
      pState - existing blockstate or null
      pFluidState - existing fluidstate or null
      Returns:
      true if so.
    • isLadder

      public static boolean isLadder(net.minecraft.world.level.block.state.BlockState blockState, @Nullable @Nullable PathingOptions options)
      Checks if the given state is a ladder, or if pathing options allow a different type of climbable
      Parameters:
      blockState -
      options -
      Returns:
    • isLadder

      public static boolean isLadder(net.minecraft.world.level.block.state.BlockState state, PathingOptions options, int nextX, int nextY, int nextZ, CachingBlockLookup cachedBlockLookup)
    • isDangerous

      public static boolean isDangerous(net.minecraft.world.level.block.state.BlockState blockState)
      Is the surface inherently dangerous to stand on/in (i.e. causes damage).
      Parameters:
      blockState - block to check.
      Returns:
      true if dangerous.
    • hasAnyCollisionAlong

      public static boolean hasAnyCollisionAlong(int startX, int startY, int startZ, int endX, int endY, int endZ, CachingBlockLookup blockLookup)
      Checks for collisions along a line between two given positions
      Parameters:
      startX -
      startY -
      startZ -
      endX -
      endY -
      endZ -
      blockLookup -
      Returns: