Search in sources :

Example 16 with Vec3D

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

the class PlayerNavigation method b.

private boolean b(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
    for (BlockPosition localBlockPosition : BlockPosition.a(new BlockPosition(paramInt1, paramInt2, paramInt3), new BlockPosition(paramInt1 + paramInt4 - 1, paramInt2 + paramInt5 - 1, paramInt3 + paramInt6 - 1))) {
        double d1 = localBlockPosition.getX() + 0.5D - paramVec3D.x;
        double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.z;
        if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
            Block localBlock = this.b.getType(localBlockPosition).getBlock();
            if (!localBlock.b(this.b, localBlockPosition)) {
                return false;
            }
        }
    }
    return true;
}
Also used : BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) Block(net.minecraft.server.v1_11_R1.Block)

Example 17 with Vec3D

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

the class PlayerNavigation method a.

@Override
protected void a(Vec3D paramVec3D) {
    if (this.g - this.h > 100) {
        if (paramVec3D.distanceSquared(this.i) < 2.25D) {
            o();
        }
        this.h = this.g;
        this.i = paramVec3D;
    }
    if ((this.c != null) && (!this.c.b())) {
        Vec3D localVec3D = this.c.f();
        if (localVec3D.equals(this.j)) {
            this.k += System.currentTimeMillis() - this.l;
        } else {
            this.j = localVec3D;
            double d1 = paramVec3D.f(this.j);
            this.m = (this.a.cq() > 0.0F ? d1 / this.a.cq() * 1000.0D : 0.0D);
        }
        if ((this.m > 0.0D) && (this.k > this.m * 3.0D)) {
            this.j = Vec3D.a;
            this.k = 0L;
            this.m = 0.0D;
            o();
        }
        this.l = System.currentTimeMillis();
    }
}
Also used : Vec3D(net.minecraft.server.v1_11_R1.Vec3D)

Example 18 with Vec3D

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

the class PlayerNavigation method a.

@Override
protected boolean a(Vec3D paramVec3D1, Vec3D paramVec3D2, int paramInt1, int paramInt2, int paramInt3) {
    int i = MathHelper.floor(paramVec3D1.x);
    int j = MathHelper.floor(paramVec3D1.z);
    double d1 = paramVec3D2.x - paramVec3D1.x;
    double d2 = paramVec3D2.z - paramVec3D1.z;
    double d3 = d1 * d1 + d2 * d2;
    if (d3 < 1.0E-8D) {
        return false;
    }
    double d4 = 1.0D / Math.sqrt(d3);
    d1 *= d4;
    d2 *= d4;
    paramInt1 += 2;
    paramInt3 += 2;
    if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
        return false;
    }
    paramInt1 -= 2;
    paramInt3 -= 2;
    double d5 = 1.0D / Math.abs(d1);
    double d6 = 1.0D / Math.abs(d2);
    double d7 = i - paramVec3D1.x;
    double d8 = j - paramVec3D1.z;
    if (d1 >= 0.0D) {
        d7 += 1.0D;
    }
    if (d2 >= 0.0D) {
        d8 += 1.0D;
    }
    d7 /= d1;
    d8 /= d2;
    int k = d1 < 0.0D ? -1 : 1;
    int m = d2 < 0.0D ? -1 : 1;
    int n = MathHelper.floor(paramVec3D2.x);
    int i1 = MathHelper.floor(paramVec3D2.z);
    int i2 = n - i;
    int i3 = i1 - j;
    while ((i2 * k > 0) || (i3 * m > 0)) {
        if (d7 < d8) {
            d7 += d5;
            i += k;
            i2 = n - i;
        } else {
            d8 += d6;
            j += m;
            i3 = i1 - j;
        }
        if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
            return false;
        }
    }
    return true;
}
Also used : PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 19 with Vec3D

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

the class PlayerNavigation method a.

private boolean a(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
    int i = paramInt1 - paramInt4 / 2;
    int j = paramInt3 - paramInt6 / 2;
    if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
        return false;
    }
    for (int k = i; k < i + paramInt4; k++) {
        for (int m = j; m < j + paramInt6; m++) {
            double d1 = k + 0.5D - paramVec3D.x;
            double d2 = m + 0.5D - paramVec3D.z;
            if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
                PathType localPathType = this.e.a(this.b, k, paramInt2 - 1, m, this.a, paramInt4, paramInt5, paramInt6, true, true);
                if (localPathType == PathType.WATER) {
                    return false;
                }
                if (localPathType == PathType.LAVA) {
                    return false;
                }
                if (localPathType == PathType.OPEN) {
                    return false;
                }
                localPathType = this.e.a(this.b, k, paramInt2, m, this.a, paramInt4, paramInt5, paramInt6, true, true);
                float f1 = this.a.a(localPathType);
                if ((f1 < 0.0F) || (f1 >= 8.0F)) {
                    return false;
                }
                if ((localPathType == PathType.DAMAGE_FIRE) || (localPathType == PathType.DANGER_FIRE) || (localPathType == PathType.DAMAGE_OTHER)) {
                    return false;
                }
            }
        }
    }
    return true;
}
Also used : PathType(net.minecraft.server.v1_11_R1.PathType) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 20 with Vec3D

use of net.minecraft.server.v1_11_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_10_R1.Vec3D)5 Vec3D (net.minecraft.server.v1_11_R1.Vec3D)5 Vec3D (net.minecraft.server.v1_12_R1.Vec3D)5 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)3 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)3 Vec3D (net.minecraft.server.v1_8_R3.Vec3D)3 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)2 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)2 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)1 EntityHuman (net.minecraft.server.v1_10_R1.EntityHuman)1 EntityPolarBear (net.minecraft.server.v1_10_R1.EntityPolarBear)1 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)1 AxisAlignedBB (net.minecraft.server.v1_11_R1.AxisAlignedBB)1 Block (net.minecraft.server.v1_11_R1.Block)1 EntityHuman (net.minecraft.server.v1_11_R1.EntityHuman)1 EntityPolarBear (net.minecraft.server.v1_11_R1.EntityPolarBear)1 PathType (net.minecraft.server.v1_11_R1.PathType)1 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)1 EntityBird (net.minecraft.server.v1_12_R1.EntityBird)1 EntityPolarBear (net.minecraft.server.v1_12_R1.EntityPolarBear)1