Search in sources :

Example 41 with Vec3D

use of net.minecraft.server.v1_15_R1.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 (!this.b(var11, var1, var12, var3, var4, var5, var6, var7, var9)) {
        return false;
    } else {
        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 (var19 == PathType.WATER) {
                        return false;
                    }
                    if (var19 == PathType.LAVA) {
                        return false;
                    }
                    if (var19 == PathType.OPEN) {
                        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_15_R1.PathType) PathPoint(net.minecraft.server.v1_15_R1.PathPoint)

Example 42 with Vec3D

use of net.minecraft.server.v1_15_R1.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 43 with Vec3D

use of net.minecraft.server.v1_15_R1.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 44 with Vec3D

use of net.minecraft.server.v1_15_R1.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 45 with Vec3D

use of net.minecraft.server.v1_15_R1.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 Vec3D (net.minecraft.server.v1_8_R3.Vec3D)4 Gravity (net.citizensnpcs.trait.Gravity)3 BlockPosition (net.minecraft.server.v1_15_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 PacketPlayOutEntityLook (net.minecraft.server.v1_15_R1.PacketPlayOutEntity.PacketPlayOutEntityLook)2 PathPoint (net.minecraft.server.v1_15_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