use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
@Override
public boolean a(PathEntity var0, double var1) {
if (var0 == null) {
this.c = null;
return false;
} else {
if (!var0.a(this.c)) {
this.c = var0;
}
if (this.m()) {
return false;
} else {
this.F_();
if (this.c.e() <= 0) {
return false;
} else {
this.d = var1;
Vec3D var3 = this.b();
this.f = this.e;
this.g = var3;
return true;
}
}
}
}
use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class EntityHumanNPC method playerTick.
@Override
public void playerTick() {
if (npc == null) {
super.playerTick();
return;
}
entityBaseTick();
boolean navigating = npc.getNavigator().isNavigating();
if (!navigating && getBukkitEntity() != null && (!npc.hasTrait(Gravity.class) || npc.getOrAddTrait(Gravity.class).hasGravity()) && Util.isLoaded(getBukkitEntity().getLocation(LOADED_LOCATION))) {
moveWithFallDamage(new Vec3D(0, 0, 0));
}
Vec3D mot = getMot();
if (Math.abs(mot.getX()) < EPSILON && Math.abs(mot.getY()) < EPSILON && Math.abs(mot.getZ()) < EPSILON) {
setMot(new Vec3D(0, 0, 0));
}
if (navigating) {
if (!NMSImpl.isNavigationFinished(navigation)) {
NMSImpl.updateNavigation(navigation);
}
moveOnCurrentHeading();
}
NMSImpl.updateAI(this);
this.ar = this.as;
if (this.hurtTicks > 0) {
this.hurtTicks -= 1;
}
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
collideNearby();
}
tickPotionEffects();
this.aM = this.aL;
this.aB = this.aA;
this.aD = this.aC;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
}
use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method b.
private boolean b(Vec3D var0) {
if (this.c.f() + 1 >= this.c.e())
return false;
Vec3D var1 = Vec3D.c(this.c.g());
if (!var0.a(var1, 2.0D))
return false;
Vec3D var2 = Vec3D.c(this.c.d(this.c.f() + 1));
Vec3D var3 = var2.d(var1);
Vec3D var4 = var0.d(var1);
return (var3.b(var4) > 0.0D);
}
use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
@Override
protected void a(Vec3D var0) {
if (this.e - this.f > 100) {
if (var0.distanceSquared(this.g) < 2.25D) {
this.t = true;
o();
} else {
this.t = false;
}
this.f = this.e;
this.g = var0;
}
if (this.c != null && !this.c.c()) {
BaseBlockPosition var1 = this.c.g();
if (var1.equals(this.h)) {
this.i += SystemUtils.getMonotonicMillis() - this.j;
} else {
this.h = var1;
double var2 = var0.f(Vec3D.c(this.h));
this.k = (this.a.dN() > 0.0F) ? (var2 / this.a.dN() * 1000.0D) : 0.0D;
}
if (this.k > 0.0D && this.i > this.k * 3.0D) {
e();
o();
}
this.j = SystemUtils.getMonotonicMillis();
}
}
use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
@Override
public boolean a(PathEntity var0, double var1) {
if (var0 == null) {
this.c = null;
return false;
}
if (!var0.a(this.c))
this.c = var0;
if (m())
return false;
D_();
if (this.c.e() <= 0)
return false;
this.d = var1;
Vec3D var3 = b();
this.f = this.e;
this.g = var3;
return true;
}
Aggregations