Class RandomPos
java.lang.Object
net.minecraft.world.entity.ai.util.RandomPos
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BlockPosgenerateRandomDirection(RandomSource random, int horizontalDist, int verticalDist) Gets a random position within a certain distance.static @Nullable BlockPosgenerateRandomDirectionWithinRadians(RandomSource random, double minHorizontalDist, double maxHorizontalDist, int verticalDist, int flyingHeight, double xDir, double zDir, double maxXzRadiansFromDir) static @Nullable Vec3generateRandomPos(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 positionstatic @Nullable Vec3generateRandomPos(PathfinderMob mob, Supplier<@Nullable BlockPos> posSupplier) static BlockPosgenerateRandomPosTowardDirection(PathfinderMob mob, double xzDist, RandomSource random, BlockPos direction) static BlockPosmoveUpOutOfSolid(BlockPos pos, int maxY, Predicate<BlockPos> solidityTester) static BlockPosmoveUpToAboveSolid(BlockPos pos, int aboveSolidAmount, int maxY, Predicate<BlockPos> solidityTester) Finds a position above based on the conditions.
-
Field Details
-
RANDOM_POS_ATTEMPTS
private static final int RANDOM_POS_ATTEMPTS- See Also:
-
-
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
-
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)
-