Search in sources :

Example 41 with Vec3D

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;
            }
        }
    }
}
Also used : Vec3D(net.minecraft.server.v1_15_R1.Vec3D)

Example 42 with Vec3D

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;
}
Also used : Vec3D(net.minecraft.server.v1_16_R3.Vec3D) Gravity(net.citizensnpcs.trait.Gravity)

Example 43 with Vec3D

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);
}
Also used : Vec3D(net.minecraft.server.v1_16_R3.Vec3D)

Example 44 with Vec3D

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;
}
Also used : Vec3D(net.minecraft.server.v1_16_R3.Vec3D)

Example 45 with Vec3D

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();
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_14_R1.AxisAlignedBB) EntitySize(net.minecraft.server.v1_14_R1.EntitySize) Vec3D(net.minecraft.server.v1_14_R1.Vec3D) EntityPose(net.minecraft.server.v1_14_R1.EntityPose)

Aggregations

Vec3D (net.minecraft.server.v1_16_R3.Vec3D)11 Vec3D (net.minecraft.server.v1_15_R1.Vec3D)10 Vec3D (net.minecraft.server.v1_14_R1.Vec3D)9 Vec3D (net.minecraft.server.v1_12_R1.Vec3D)7 Vec3D (net.minecraft.server.v1_10_R1.Vec3D)5 Vec3D (net.minecraft.server.v1_11_R1.Vec3D)5 Vec3D (net.minecraft.server.v1_8_R3.Vec3D)4 Gravity (net.citizensnpcs.trait.Gravity)3 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)3 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)2 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)2 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)2 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)2 MovingObjectPosition (net.minecraft.server.v1_12_R1.MovingObjectPosition)2 PathPoint (net.minecraft.server.v1_14_R1.PathPoint)2 AxisAlignedBB (net.minecraft.server.v1_16_R3.AxisAlignedBB)2 BaseBlockPosition (net.minecraft.server.v1_16_R3.BaseBlockPosition)2 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)2 PathPoint (net.minecraft.server.v1_16_R3.PathPoint)2 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)2