Search in sources :

Example 41 with Vec3D

use of net.minecraft.server.v1_16_R3.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_16_R3.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_16_R3.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_16_R3.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.t = true;
            o();
        } else {
            this.t = false;
        }
        this.f = this.e;
        this.g = var0;
    }
    if (this.c != null && !this.c.c()) {
        BaseBlockPosition var1 = this.c.g();
        if (var1.equals(this.h)) {
            this.i += SystemUtils.getMonotonicMillis() - this.j;
        } else {
            this.h = var1;
            double var2 = var0.f(Vec3D.c(this.h));
            this.k = (this.a.dN() > 0.0F) ? (var2 / this.a.dN() * 1000.0D) : 0.0D;
        }
        if (this.k > 0.0D && this.i > this.k * 3.0D) {
            e();
            o();
        }
        this.j = SystemUtils.getMonotonicMillis();
    }
}
Also used : BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition)

Example 45 with Vec3D

use of net.minecraft.server.v1_16_R3.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)

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 BaseBlockPosition (net.minecraft.server.v1_16_R3.BaseBlockPosition)4 Vec3D (net.minecraft.server.v1_8_R3.Vec3D)4 Gravity (net.citizensnpcs.trait.Gravity)3 PathPoint (net.minecraft.server.v1_16_R3.PathPoint)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 AxisAlignedBB (net.minecraft.server.v1_16_R3.AxisAlignedBB)2 BlockPosition (net.minecraft.server.v1_16_R3.BlockPosition)2 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)2 LivingEntity (org.bukkit.entity.LivingEntity)2 Warlords (com.ebicep.warlords.Warlords)1