AirRandomPos .java

net.minecraft.world.entity.ai.util.AirRandomPos (class, 20 lines): members: towardsPos, getPosTowards. imports: PathfinderMob, Vec3, BlockPos.

net.minecraft.world.entity.ai.utilclass20 linescommon864 B

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (1)

towardsPos

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

AirRandomPos.java20 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.ai.util;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.world.entity.PathfinderMob;
5
import net.minecraft.world.phys.Vec3;
6
import org.jspecify.annotations.Nullable;
7
8
public class AirRandomPos {
9
	public static @Nullable Vec3 getPosTowards(
10
		final PathfinderMob mob, final int horizontalDist, final int verticalDist, final int flyingHeight, final Vec3 towardsPos, final double maxXzRadiansFromDir
11
	) {
12
		Vec3 dir = towardsPos.subtract(mob.getX(), mob.getY(), mob.getZ());
13
		boolean restrict = GoalUtils.mobRestricted(mob, horizontalDist);
14
		return RandomPos.generateRandomPos(mob, () -> {
15
			BlockPos pos = AirAndWaterRandomPos.generateRandomPos(mob, horizontalDist, verticalDist, flyingHeight, dir.x, dir.z, maxXzRadiansFromDir, restrict);
16
			return pos != null && !GoalUtils.isWater(mob, pos) ? pos : null;
17
		});
18
	}
19
}
20

Decompiled Minecraft 26.3 source of AirRandomPos (net/minecraft/world/entity/ai/util/AirRandomPos.java) with Mojang official mappings, stored verbatim on the site.