Class RandomPos

java.lang.Object
net.minecraft.world.entity.ai.util.RandomPos

public class RandomPos extends Object
  • Field Details

  • Constructor Details

    • RandomPos

      public RandomPos()
  • Method Details

    • generateRandomDirection

      public static BlockPos generateRandomDirection(RandomSource random, int horizontalDist, int verticalDist)
      Gets a random position within a certain distance.
    • generateRandomDirectionWithinRadians

      public static @Nullable BlockPos generateRandomDirectionWithinRadians(RandomSource random, double minHorizontalDist, double maxHorizontalDist, int verticalDist, int flyingHeight, double xDir, double zDir, double maxXzRadiansFromDir)
    • moveUpOutOfSolid

      public static BlockPos moveUpOutOfSolid(BlockPos pos, int maxY, Predicate<BlockPos> solidityTester)
      Returns:
      the highest above position that is within the provided conditions
    • moveUpToAboveSolid

      public static BlockPos moveUpToAboveSolid(BlockPos pos, int aboveSolidAmount, int maxY, Predicate<BlockPos> solidityTester)
      Finds a position above based on the conditions. After it finds the position once, it will continue to move up until aboveSolidAmount is reached or the position is no longer valid
    • generateRandomPos

      public static @Nullable Vec3 generateRandomPos(PathfinderMob mob, Supplier<@Nullable BlockPos> posSupplier)
    • generateRandomPos

      public static @Nullable Vec3 generateRandomPos(Supplier<@Nullable BlockPos> posSupplier, ToDoubleFunction<BlockPos> positionWeightFunction)
      Tries 10 times to maximize the return value of the position to double function based on the supplied position
    • generateRandomPosTowardDirection

      public static BlockPos generateRandomPosTowardDirection(PathfinderMob mob, double xzDist, RandomSource random, BlockPos direction)