Search in sources :

Example 46 with Vec3D

use of net.minecraft.server.v1_14_R1.Vec3D in project Citizens2 by CitizensDev.

the class PlayerNavigation method a.

@Override
protected boolean a(Vec3D var0, Vec3D var1, int var2, int var3, int var4) {
    int var5 = MathHelper.floor(var0.x);
    int var6 = MathHelper.floor(var0.z);
    double var7 = var1.x - var0.x;
    double var9 = var1.z - var0.z;
    double var11 = var7 * var7 + var9 * var9;
    if (var11 < 1.0E-8D) {
        return false;
    } else {
        double var13 = 1.0D / Math.sqrt(var11);
        var7 *= var13;
        var9 *= var13;
        var2 += 2;
        var4 += 2;
        if (!this.a(var5, MathHelper.floor(var0.y), var6, var2, var3, var4, var0, var7, var9)) {
            return false;
        } else {
            var2 -= 2;
            var4 -= 2;
            double var15 = 1.0D / Math.abs(var7);
            double var17 = 1.0D / Math.abs(var9);
            double var19 = var5 - var0.x;
            double var21 = var6 - var0.z;
            if (var7 >= 0.0D) {
                ++var19;
            }
            if (var9 >= 0.0D) {
                ++var21;
            }
            var19 /= var7;
            var21 /= var9;
            int var23 = var7 < 0.0D ? -1 : 1;
            int var24 = var9 < 0.0D ? -1 : 1;
            int var25 = MathHelper.floor(var1.x);
            int var26 = MathHelper.floor(var1.z);
            int var27 = var25 - var5;
            int var28 = var26 - var6;
            do {
                if (var27 * var23 <= 0 && var28 * var24 <= 0) {
                    return true;
                }
                if (var19 < var21) {
                    var19 += var15;
                    var5 += var23;
                    var27 = var25 - var5;
                } else {
                    var21 += var17;
                    var6 += var24;
                    var28 = var26 - var6;
                }
            } while (this.a(var5, MathHelper.floor(var0.y), var6, var2, var3, var4, var0, var7, var9));
            return false;
        }
    }
}
Also used : PathPoint(net.minecraft.server.v1_14_R1.PathPoint)

Example 47 with Vec3D

use of net.minecraft.server.v1_14_R1.Vec3D in project Citizens2 by CitizensDev.

the class PlayerNavigation method b.

private boolean b(int var0, int var1, int var2, int var3, int var4, int var5, Vec3D var6, double var7, double var9) {
    Iterator var12 = BlockPosition.a(new BlockPosition(var0, var1, var2), new BlockPosition(var0 + var3 - 1, var1 + var4 - 1, var2 + var5 - 1)).iterator();
    BlockPosition var14;
    double var13;
    double var15;
    do {
        if (!var12.hasNext()) {
            return true;
        }
        var14 = (BlockPosition) var12.next();
        var13 = var14.getX() + 0.5D - var6.x;
        var15 = var14.getZ() + 0.5D - var6.z;
    } while (var13 * var7 + var15 * var9 < 0.0D || this.b.getType(var14).a(this.b, var14, PathMode.LAND));
    return false;
}
Also used : BlockPosition(net.minecraft.server.v1_14_R1.BlockPosition) Iterator(java.util.Iterator)

Example 48 with Vec3D

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

Example 49 with Vec3D

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

Example 50 with Vec3D

use of net.minecraft.server.v1_14_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();
    }
}
Also used : Vec3D(net.minecraft.server.v1_12_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_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