
net.minecraft.server.NavigationGuardian Maven / Gradle / Ivy
package net.minecraft.server;
public class NavigationGuardian extends NavigationAbstract {
public NavigationGuardian(EntityInsentient entityinsentient, World world) {
super(entityinsentient, world);
}
protected Pathfinder a() {
return new Pathfinder(new PathfinderWater());
}
protected boolean canNavigate() {
return this.isInLiquid();
}
protected Vec3D getEntityPosition() {
return new Vec3D(this.entity.locX, this.entity.locY + (double) this.entity.length * 0.5D, this.entity.locZ);
}
protected void pathFollow() {
Vec3D vec3d = this.getEntityPosition();
float f = this.entity.width * this.entity.width;
byte b0 = 6;
if (vec3d.distanceSquared(this.currentPath.a(this.entity, this.currentPath.e())) < (double) f) {
this.currentPath.a();
}
for (int i = Math.min(this.currentPath.e() + b0, this.currentPath.d() - 1); i > this.currentPath.e(); --i) {
Vec3D vec3d1 = this.currentPath.a(this.entity, i);
if (vec3d1.distanceSquared(vec3d) <= 36.0D && this.isDirectPathBetweenPoints(vec3d, vec3d1, 0, 0, 0)) {
this.currentPath.c(i);
break;
}
}
this.checkForStuck(vec3d);
}
protected void removeSunnyPath() {
super.removeSunnyPath();
}
protected boolean isDirectPathBetweenPoints(Vec3D vec3d, Vec3D vec3d1, int sizeX, int sizeY, int sizeZ) {
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, new Vec3D(vec3d1.a, vec3d1.b + (double) this.entity.length * 0.5D, vec3d1.c), false, true, false);
return movingobjectposition == null || movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.MISS;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy