use of net.minecraft.server.v1_15_R1.Vec3D in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, boolean justCreated) {
try {
EntitySize entitysize = (EntitySize) SIZE_FIELD_GETTER.invoke(entity);
EntityPose entitypose = entity.getPose();
EntitySize entitysize1 = entity.a(entitypose);
SIZE_FIELD_SETTER.invoke(entity, entitysize1);
HEAD_HEIGHT.invoke(entity, HEAD_HEIGHT_METHOD.invoke(entity, entitypose, entitysize1));
if (entitysize1.width < entitysize.width && false) /* TODO: PREVIOUS CITIZENS ADDITION ?reason */
{
double d0 = entitysize1.width / 2.0D;
entity.a(new AxisAlignedBB(entity.locX - d0, entity.locY, entity.locZ - d0, entity.locX + d0, entity.locY + entitysize1.height, entity.locZ + d0));
} else {
AxisAlignedBB axisalignedbb = entity.getBoundingBox();
entity.a(new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + entitysize1.width, axisalignedbb.minY + entitysize1.height, axisalignedbb.minZ + entitysize1.width));
if (entitysize1.width > entitysize.width && !justCreated && !entity.world.isClientSide) {
float f = entitysize.width - entitysize1.width;
entity.move(EnumMoveType.SELF, new Vec3D(f, 0.0D, f));
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
use of net.minecraft.server.v1_15_R1.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method c.
@Override
public void c() {
++this.e;
if (this.m) {
this.k();
}
if (!this.n()) {
Vec3D var0;
if (this.a()) {
this.m();
} else if (this.c != null && this.c.f() < this.c.e()) {
var0 = this.b();
Vec3D var1 = this.c.a(this.a, this.c.f());
if (var0.y > var1.y && !this.a.onGround && MathHelper.floor(var0.x) == MathHelper.floor(var1.x) && MathHelper.floor(var0.z) == MathHelper.floor(var1.z)) {
this.c.c(this.c.f() + 1);
}
}
if (!this.n()) {
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_15_R1.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.o();
}
this.f = this.e;
this.g = var0;
}
if (this.c != null && !this.c.b()) {
Vec3D var1 = this.c.g();
if (var1.equals(this.h)) {
this.i += SystemUtils.getMonotonicMillis() - this.j;
} else {
this.h = var1;
double var2 = var0.f(this.h);
this.k = this.a.db() > 0.0F ? var2 / this.a.db() * 1000.0D : 0.0D;
}
if (this.k > 0.0D && this.i > this.k * 3.0D) {
this.h = Vec3D.a;
this.i = 0L;
this.k = 0.0D;
this.o();
}
this.j = SystemUtils.getMonotonicMillis();
}
}
use of net.minecraft.server.v1_15_R1.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method a.
@Override
protected void a(Vec3D paramVec3D) {
if (this.e - this.j > 100) {
if (paramVec3D.distanceSquared(this.k) < 2.25D) {
p();
}
this.j = this.e;
this.k = paramVec3D;
}
if ((this.c != null) && (!this.c.b())) {
Vec3D localVec3D = this.c.f();
if (localVec3D.equals(this.l)) {
this.m += System.currentTimeMillis() - this.n;
} else {
this.l = localVec3D;
double d1 = paramVec3D.f(this.l);
this.o = (this.a.cy() > 0.0F ? d1 / this.a.cy() * 1000.0D : 0.0D);
}
if ((this.o > 0.0D) && (this.m > this.o * 3.0D)) {
this.l = Vec3D.a;
this.m = 0L;
this.o = 0.0D;
p();
}
this.n = System.currentTimeMillis();
}
}
use of net.minecraft.server.v1_15_R1.Vec3D in project Citizens2 by CitizensDev.
the class PlayerNavigation method d.
@Override
public void d() {
this.e += 1;
if (this.g) {
k();
}
if (o()) {
return;
}
if (b()) {
n();
} else if ((this.c != null) && (this.c.e() < this.c.d())) {
Vec3D localVec3D = c();
Vec3D localObject = this.c.a(this.a, this.c.e());
if ((localVec3D.y > localObject.y) && (!this.a.onGround) && (MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x)) && (MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z))) {
this.c.c(this.c.e() + 1);
}
}
m();
if (o()) {
return;
}
Vec3D localVec3D = this.c.a(this.a);
Object localObject = new BlockPosition(localVec3D).down();
AxisAlignedBB localAxisAlignedBB = this.b.getType((BlockPosition) localObject).e(this.b, (BlockPosition) localObject);
localVec3D = localVec3D.a(0.0D, 1.0D - localAxisAlignedBB.e, 0.0D);
this.a.getControllerMove().a(localVec3D.x, localVec3D.y, localVec3D.z, this.d);
}
Aggregations