AmphibiousPathNavigation .java

net.minecraft.world.entity.ai.navigation.AmphibiousPathNavigation (class): members: getGroundY, isStableDestination, canMoveDirectly, setCanFloat.

net.minecraft.world.entity.ai.navigationclass55 linescommonextends PathNavigation1.4 KB

API Surface (8)

PathFinder createPathFinder(final int maxVisitedNodes)
boolean canUpdatePath()
Vec3 getTempMobPos()
double getGroundY(final Vec3 target)
boolean canMoveDirectly(final Vec3 startPos, final Vec3 stopPos)
boolean isStableDestination(final BlockPos pos)
void setCanFloat(final boolean canFloat)
boolean canNavigateGround()

Full Source

AmphibiousPathNavigation.java55 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.ai.navigation;
2
3
import net.minecraft.core.BlockPos;
4
import net.minecraft.world.entity.Mob;
5
import net.minecraft.world.level.Level;
6
import net.minecraft.world.level.pathfinder.AmphibiousNodeEvaluator;
7
import net.minecraft.world.level.pathfinder.PathFinder;
8
import net.minecraft.world.phys.Vec3;
9
10
public class AmphibiousPathNavigation extends PathNavigation {
11
	public AmphibiousPathNavigation(final Mob mob, final Level level) {
12
		super(mob, level);
13
	}
14
15
	@Override
16
	protected PathFinder createPathFinder(final int maxVisitedNodes) {
17
		this.nodeEvaluator = new AmphibiousNodeEvaluator(false);
18
		return new PathFinder(this.nodeEvaluator, maxVisitedNodes);
19
	}
20
21
	@Override
22
	protected boolean canUpdatePath() {
23
		return true;
24
	}
25
26
	@Override
27
	protected Vec3 getTempMobPos() {
28
		return new Vec3(this.mob.getX(), this.mob.getY(0.5), this.mob.getZ());
29
	}
30
31
	@Override
32
	protected double getGroundY(final Vec3 target) {
33
		return target.y;
34
	}
35
36
	@Override
37
	protected boolean canMoveDirectly(final Vec3 startPos, final Vec3 stopPos) {
38
		return this.mob.isInLiquid() ? isClearForMovementBetween(this.mob, startPos, stopPos, false) : false;
39
	}
40
41
	@Override
42
	public boolean isStableDestination(final BlockPos pos) {
43
		return !this.level.getBlockState(pos.below()).isAir();
44
	}
45
46
	@Override
47
	public void setCanFloat(final boolean canFloat) {
48
	}
49
50
	@Override
51
	public boolean canNavigateGround() {
52
		return true;
53
	}
54
}
55

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