Search in sources :

Example 16 with Vec3D

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

the class PlayerNavigation method m.

@Override
protected void m() {
    Vec3D localVec3D1 = c();
    int i1 = this.c.d();
    for (int i2 = this.c.e(); i2 < this.c.d(); i2++) {
        if (this.c.a(i2).b != Math.floor(localVec3D1.y)) {
            i1 = i2;
            break;
        }
    }
    this.n = (this.a.width > 0.75F ? this.a.width / 2.0F : 0.75F - this.a.width / 2.0F);
    Vec3D localVec3D2 = this.c.f();
    if ((MathHelper.e((float) (this.a.locX - (localVec3D2.x + 0.5D))) < this.n) && (MathHelper.e((float) (this.a.locZ - (localVec3D2.z + 0.5D))) < this.n) && (Math.abs(this.a.locY - localVec3D2.y) < 1.0D)) {
        this.c.c(this.c.e() + 1);
    }
    int i3 = MathHelper.f(this.a.width);
    int i4 = MathHelper.f(this.a.length);
    int i5 = i3;
    for (int i6 = i1 - 1; i6 >= this.c.e(); i6--) {
        if (a(localVec3D1, this.c.a(this.a, i6), i3, i4, i5)) {
            this.c.c(i6);
            break;
        }
    }
    a(localVec3D1);
}
Also used : Vec3D(net.minecraft.server.v1_11_R1.Vec3D) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 17 with Vec3D

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

Example 19 with Vec3D

use of net.minecraft.server.v1_12_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_12_R1.BlockPosition) Block(net.minecraft.server.v1_12_R1.Block)

Example 20 with Vec3D

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

the class PlayerNavigation method d.

@Override
public void d() {
    this.e += 1;
    if (this.g) {
        k();
    }
    if (o()) {
        return;
    }
    if (b()) {
        n();
    } else if ((this.c != null) && (this.c.e() < this.c.d())) {
        Vec3D localVec3D = c();
        Vec3D localObject = this.c.a(this.a, this.c.e());
        if ((localVec3D.y > localObject.y) && (!this.a.onGround) && (MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x)) && (MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z))) {
            this.c.c(this.c.e() + 1);
        }
    }
    m();
    if (o()) {
        return;
    }
    Vec3D localVec3D = this.c.a(this.a);
    Object localObject = new BlockPosition(localVec3D).down();
    AxisAlignedBB localAxisAlignedBB = this.b.getType((BlockPosition) localObject).e(this.b, (BlockPosition) localObject);
    localVec3D = localVec3D.a(0.0D, 1.0D - localAxisAlignedBB.e, 0.0D);
    this.a.getControllerMove().a(localVec3D.x, localVec3D.y, localVec3D.z, this.d);
}
Also used : AxisAlignedBB(net.minecraft.server.v1_12_R1.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) 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_12_R1.BlockPosition)3 PathPoint (net.minecraft.server.v1_12_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_11_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 EntityHuman (net.minecraft.server.v1_11_R1.EntityHuman)1 EntityPolarBear (net.minecraft.server.v1_11_R1.EntityPolarBear)1 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)1 AxisAlignedBB (net.minecraft.server.v1_12_R1.AxisAlignedBB)1 Block (net.minecraft.server.v1_12_R1.Block)1 EntityBird (net.minecraft.server.v1_12_R1.EntityBird)1 EntityPolarBear (net.minecraft.server.v1_12_R1.EntityPolarBear)1