Search in sources :

Example 21 with Vec3D

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

Example 22 with Vec3D

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

Example 23 with Vec3D

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

Example 24 with Vec3D

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

Example 25 with Vec3D

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

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_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 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)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 LivingEntity (org.bukkit.entity.LivingEntity)2