use of net.minecraft.server.v1_16_R2.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;
}
this.D_();
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_R2.Vec3D in project Citizens2 by CitizensDev.
the class EntityHumanNPC method moveOnCurrentHeading.
private void moveOnCurrentHeading() {
if (jumping) {
if (onGround && jumpTicks == 0) {
jump();
jumpTicks = 10;
}
} else {
jumpTicks = 0;
}
aZ *= 0.98F;
bb *= 0.98F;
// movement method
moveWithFallDamage(new Vec3D(this.aZ, this.ba, this.bb));
NMS.setHeadYaw(getBukkitEntity(), yaw);
if (jumpTicks > 0) {
jumpTicks--;
}
}
use of net.minecraft.server.v1_16_R2.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.az = this.aA;
if (this.hurtTicks > 0) {
this.hurtTicks -= 1;
}
if (npc.data().get(NPC.Metadata.COLLIDABLE, !npc.isProtected())) {
collideNearby();
}
tickPotionEffects();
this.aU = this.aT;
this.aJ = this.aI;
this.aL = this.aK;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
}
use of net.minecraft.server.v1_16_R2.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method b.
@Override
public void b(BlockPosition var0) {
if (this.c != null && !this.c.b() && this.c.e() != 0) {
PathPoint var1 = this.c.c();
Vec3D var2 = new Vec3D((var1.a + this.a.locX) / 2.0D, (var1.b + this.a.locY) / 2.0D, (var1.c + this.a.locZ) / 2.0D);
if (var0.a(var2, this.c.e() - this.c.f())) {
this.k();
}
}
}
use of net.minecraft.server.v1_16_R2.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method m.
@Override
protected void m() {
Vec3D var0 = this.b();
this.l = this.a.getWidth() > 0.75F ? this.a.getWidth() / 2.0F : 0.75F - this.a.getWidth() / 2.0F;
Vec3D var1 = this.c.g();
if (Math.abs(this.a.locX - (var1.x + 0.5D)) < this.l && Math.abs(this.a.locZ - (var1.z + 0.5D)) < this.l && Math.abs(this.a.locY - var1.y) < 1.0D) {
this.c.c(this.c.f() + 1);
}
this.a(var0);
}
Aggregations