Search in sources :

Example 46 with Vec3D

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

the class PlayerNavigation method a.

private boolean a(int var0, int var1, int var2, int var3, int var4, int var5, Vec3D var6, double var7, double var9) {
    int var11 = var0 - var3 / 2;
    int var12 = var2 - var5 / 2;
    if (!b(var11, var1, var12, var3, var4, var5, var6, var7, var9))
        return false;
    for (int var13 = var11; var13 < var11 + var3; var13++) {
        for (int var14 = var12; var14 < var12 + var5; var14++) {
            double var15 = var13 + 0.5D - var6.x;
            double var17 = var14 + 0.5D - var6.z;
            if (var15 * var7 + var17 * var9 >= 0.0D) {
                PathType var19 = this.o.a(this.b, var13, var1 - 1, var14, this.a, var3, var4, var5, true, true);
                if (!a(var19))
                    return false;
                var19 = this.o.a(this.b, var13, var1, var14, this.a, var3, var4, var5, true, true);
                float var20 = this.a.a(var19);
                if (var20 < 0.0F || var20 >= 8.0F)
                    return false;
                if (var19 == PathType.DAMAGE_FIRE || var19 == PathType.DANGER_FIRE || var19 == PathType.DAMAGE_OTHER)
                    return false;
            }
        }
    }
    return true;
}
Also used : PathType(net.minecraft.server.v1_16_R3.PathType) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 47 with Vec3D

use of net.minecraft.server.v1_16_R3.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) {
    for (BlockPosition var12 : BlockPosition.a(new BlockPosition(var0, var1, var2), new BlockPosition(var0 + var3 - 1, var1 + var4 - 1, var2 + var5 - 1))) {
        double var13 = var12.getX() + 0.5D - var6.x;
        double var15 = var12.getZ() + 0.5D - var6.z;
        if (var13 * var7 + var15 * var9 < 0.0D)
            continue;
        if (!this.b.getType(var12).a(this.b, var12, PathMode.LAND))
            return false;
    }
    return true;
}
Also used : BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) BaseBlockPosition(net.minecraft.server.v1_16_R3.BaseBlockPosition)

Example 48 with Vec3D

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

the class NMSImpl method setSize.

public static void setSize(Entity entity, boolean justCreated) {
    try {
        EntitySize entitysize = (EntitySize) SIZE_FIELD_GETTER.invoke(entity);
        EntityPose entitypose = entity.getPose();
        EntitySize entitysize1 = entity.a(entitypose);
        SIZE_FIELD_SETTER.invoke(entity, entitysize1);
        HEAD_HEIGHT.invoke(entity, HEAD_HEIGHT_METHOD.invoke(entity, entitypose, entitysize1));
        if (entitysize1.width < entitysize.width && false) /* TODO: PREVIOUS CITIZENS ADDITION ?reason */
        {
            double d0 = entitysize1.width / 2.0D;
            entity.a(new AxisAlignedBB(entity.locX - d0, entity.locY, entity.locZ - d0, entity.locX + d0, entity.locY + entitysize1.height, entity.locZ + d0));
        } else {
            AxisAlignedBB axisalignedbb = entity.getBoundingBox();
            entity.a(new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.minX + entitysize1.width, axisalignedbb.minY + entitysize1.height, axisalignedbb.minZ + entitysize1.width));
            if (entitysize1.width > entitysize.width && !justCreated && !entity.world.isClientSide) {
                float f = entitysize.width - entitysize1.width;
                entity.move(EnumMoveType.SELF, new Vec3D(f, 0.0D, f));
            }
        }
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_14_R1.AxisAlignedBB) EntitySize(net.minecraft.server.v1_14_R1.EntitySize) Vec3D(net.minecraft.server.v1_14_R1.Vec3D) EntityPose(net.minecraft.server.v1_14_R1.EntityPose)

Example 49 with Vec3D

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

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