use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method c.
@Override
public void c() {
this.e++;
if (this.m)
j();
if (m())
return;
if (a()) {
l();
} else if (this.c != null && !this.c.c()) {
Vec3D vec3D1 = b();
Vec3D vec3D2 = this.c.a(this.a);
if (vec3D1.y > vec3D2.y && !this.a.isOnGround() && MathHelper.floor(vec3D1.x) == MathHelper.floor(vec3D2.x) && MathHelper.floor(vec3D1.z) == MathHelper.floor(vec3D2.z))
this.c.a();
}
if (m())
return;
Vec3D var0 = this.c.a(this.a);
BlockPosition var1 = new BlockPosition(var0);
this.a.getControllerMove().a(var0.x, this.b.getType(var1.down()).isAir() ? var0.y : PathfinderNormal.a(this.b, var1), var0.z, this.d);
}
use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
@Override
protected boolean a(Vec3D var0, Vec3D var1, int var2, int var3, int var4) {
int var5 = MathHelper.floor(var0.x);
int var6 = MathHelper.floor(var0.z);
double var7 = var1.x - var0.x;
double var9 = var1.z - var0.z;
double var11 = var7 * var7 + var9 * var9;
if (var11 < 1.0E-8D)
return false;
double var13 = 1.0D / Math.sqrt(var11);
var7 *= var13;
var9 *= var13;
var2 += 2;
var4 += 2;
if (!a(var5, MathHelper.floor(var0.y), var6, var2, var3, var4, var0, var7, var9))
return false;
var2 -= 2;
var4 -= 2;
double var15 = 1.0D / Math.abs(var7);
double var17 = 1.0D / Math.abs(var9);
double var19 = var5 - var0.x;
double var21 = var6 - var0.z;
if (var7 >= 0.0D)
var19++;
if (var9 >= 0.0D)
var21++;
var19 /= var7;
var21 /= var9;
int var23 = (var7 < 0.0D) ? -1 : 1;
int var24 = (var9 < 0.0D) ? -1 : 1;
int var25 = MathHelper.floor(var1.x);
int var26 = MathHelper.floor(var1.z);
int var27 = var25 - var5;
int var28 = var26 - var6;
while (var27 * var23 > 0 || var28 * var24 > 0) {
if (var19 < var21) {
var19 += var15;
var5 += var23;
var27 = var25 - var5;
} else {
var21 += var17;
var6 += var24;
var28 = var26 - var6;
}
if (!a(var5, MathHelper.floor(var0.y), var6, var2, var3, var4, var0, var7, var9))
return false;
}
return true;
}
use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method l.
@Override
protected void l() {
Vec3D var0 = b();
this.l = (this.a.getWidth() > 0.75F) ? (this.a.getWidth() / 2.0F) : (0.75F - this.a.getWidth() / 2.0F);
BaseBlockPosition var1 = this.c.g();
double var2 = Math.abs(this.a.locX() - var1.getX() + 0.5D);
double var4 = Math.abs(this.a.locY() - var1.getY());
double var6 = Math.abs(this.a.locZ() - var1.getZ() + 0.5D);
boolean var8 = (var2 < this.l && var6 < this.l && var4 < 1.0D);
boolean b2 = Math.abs(this.a.locX() - (var1.getX() + 0.5D)) < this.l && Math.abs(this.a.locZ() - (var1.getZ() + 0.5D)) < this.l && // old-style calc
Math.abs(this.a.locY() - var1.getY()) < 1.0D;
if (var8 || b2 || (this.a.b((this.c.h()).l) && b(var0)))
this.c.a();
a(var0);
}
use of net.minecraft.server.v1_16_R3.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method b.
@Override
public void b(BlockPosition var0) {
if (this.c == null || this.c.c() || this.c.e() == 0)
return;
PathPoint var1 = this.c.d();
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())))
j();
}
use of net.minecraft.server.v1_16_R3.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;
}
aR *= 0.98F;
aT *= 0.98F;
// movement method
moveWithFallDamage(new Vec3D(this.aR, this.aS, this.aT));
NMS.setHeadYaw(getBukkitEntity(), yaw);
if (jumpTicks > 0) {
jumpTicks--;
}
}
Aggregations