GoalUtils .java

net.minecraft.world.entity.ai.util.GoalUtils (class): members: hasGroundPathNavigation, isOutsideLimits, mobRestricted, isRestricted, isNotStable, isSolid.

net.minecraft.world.entity.ai.utilclass48 linescommon1.7 KB

API Surface (9)

boolean hasGroundPathNavigation(final Mob mob)
boolean mobRestricted(final PathfinderMob mob, final double horizontalDist)
boolean isOutsideLimits(final BlockPos pos, final PathfinderMob mob)
boolean isRestricted(final boolean restrict, final PathfinderMob mob, final BlockPos pos)
boolean isRestricted(final boolean restrict, final PathfinderMob mob, final Vec3 pos)
boolean isNotStable(final PathNavigation navigation, final BlockPos pos)
boolean isWater(final PathfinderMob mob, final BlockPos pos)
boolean hasMalus(final PathfinderMob mob, final BlockPos pos)
boolean isSolid(final PathfinderMob mob, final BlockPos pos)

Full Source

GoalUtils.java48 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.ai.util;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.tags.FluidTags;
5
import net.minecraft.world.entity.Mob;
6
import net.minecraft.world.entity.PathfinderMob;
7
import net.minecraft.world.entity.ai.navigation.PathNavigation;
8
import net.minecraft.world.level.pathfinder.WalkNodeEvaluator;
9
import net.minecraft.world.phys.Vec3;
10
11
public class GoalUtils {
12
	public static boolean hasGroundPathNavigation(final Mob mob) {
13
		return mob.getNavigation().canNavigateGround();
14
	}
15
16
	public static boolean mobRestricted(final PathfinderMob mob, final double horizontalDist) {
17
		return mob.hasHome() && mob.getHomePosition().closerToCenterThan(mob.position(), mob.getHomeRadius() + horizontalDist + 1.0);
18
	}
19
20
	public static boolean isOutsideLimits(final BlockPos pos, final PathfinderMob mob) {
21
		return mob.level().isOutsideBuildHeight(pos.getY());
22
	}
23
24
	public static boolean isRestricted(final boolean restrict, final PathfinderMob mob, final BlockPos pos) {
25
		return restrict && !mob.isWithinHome(pos);
26
	}
27
28
	public static boolean isRestricted(final boolean restrict, final PathfinderMob mob, final Vec3 pos) {
29
		return restrict && !mob.isWithinHome(pos);
30
	}
31
32
	public static boolean isNotStable(final PathNavigation navigation, final BlockPos pos) {
33
		return !navigation.isStableDestination(pos);
34
	}
35
36
	public static boolean isWater(final PathfinderMob mob, final BlockPos pos) {
37
		return mob.level().getFluidState(pos).is(FluidTags.WATER);
38
	}
39
40
	public static boolean hasMalus(final PathfinderMob mob, final BlockPos pos) {
41
		return mob.getPathfindingMalus(WalkNodeEvaluator.getPathTypeStatic(mob, pos)) != 0.0F;
42
	}
43
44
	public static boolean isSolid(final PathfinderMob mob, final BlockPos pos) {
45
		return mob.level().getBlockState(pos).isSolid();
46
	}
47
}
48

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