use of net.minecraft.server.v1_14_R1.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_14_R1.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_14_R1.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_14_R1.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;
}
use of net.minecraft.server.v1_14_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();
}
}
Aggregations