Search in sources :

Example 76 with PathPoint

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

the class PlayerPathfinderNormal method a.

private PathPoint a(int var0, int var1, int var2, int var3, double var4, EnumDirection var6, PathType var7) {
    PathPoint var8 = null;
    BlockPosition.MutableBlockPosition var9 = new BlockPosition.MutableBlockPosition();
    double var10 = aa(this.a, var9.d(var0, var1, var2));
    if (var10 - var4 > 1.125D)
        return null;
    PathType var12 = a(this.b, var0, var1, var2);
    float var13 = this.b.a(var12);
    double var14 = this.b.getWidth() / 2.0D;
    if (var13 >= 0.0F) {
        var8 = a(var0, var1, var2);
        var8.l = var12;
        var8.k = Math.max(var8.k, var13);
    }
    if (var7 == PathType.FENCE && var8 != null && var8.k >= 0.0F && !a(var8))
        var8 = null;
    if (var12 == PathType.WALKABLE)
        return var8;
    if ((var8 == null || var8.k < 0.0F) && var3 > 0 && var12 != PathType.FENCE && var12 != PathType.UNPASSABLE_RAIL && var12 != PathType.TRAPDOOR) {
        var8 = a(var0, var1 + 1, var2, var3 - 1, var4, var6, var7);
        if (var8 != null && (var8.l == PathType.OPEN || var8.l == PathType.WALKABLE) && this.b.getWidth() < 1.0F) {
            double var16 = (var0 - var6.getAdjacentX()) + 0.5D;
            double var18 = (var2 - var6.getAdjacentZ()) + 0.5D;
            AxisAlignedBB var20 = new AxisAlignedBB(var16 - var14, aa(this.a, var9.c(var16, (var1 + 1), var18)) + 0.001D, var18 - var14, var16 + var14, this.b.getHeight() + aa(this.a, var9.c(var8.a, var8.b, var8.c)) - 0.002D, var18 + var14);
            if (a(var20))
                var8 = null;
        }
    }
    if (var12 == PathType.WATER && !e()) {
        if (a(this.b, var0, var1 - 1, var2) != PathType.WATER)
            return var8;
        while (var1 > 0) {
            var1--;
            var12 = a(this.b, var0, var1, var2);
            if (var12 == PathType.WATER) {
                var8 = a(var0, var1, var2);
                var8.l = var12;
                var8.k = Math.max(var8.k, this.b.a(var12));
                continue;
            }
            return var8;
        }
    }
    if (var12 == PathType.OPEN) {
        int var16 = 0;
        int var17 = var1;
        while (var12 == PathType.OPEN) {
            var1--;
            if (var1 < 0) {
                PathPoint var18 = a(var0, var17, var2);
                var18.l = PathType.BLOCKED;
                var18.k = -1.0F;
                return var18;
            }
            if (var16++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
                PathPoint var18 = a(var0, var1, var2);
                var18.l = PathType.BLOCKED;
                var18.k = -1.0F;
                return var18;
            }
            var12 = a(this.b, var0, var1, var2);
            var13 = this.b.a(var12);
            if (var12 != PathType.OPEN && var13 >= 0.0F) {
                var8 = a(var0, var1, var2);
                var8.l = var12;
                var8.k = Math.max(var8.k, var13);
                break;
            }
            if (var13 < 0.0F) {
                PathPoint var18 = a(var0, var1, var2);
                var18.l = PathType.BLOCKED;
                var18.k = -1.0F;
                return var18;
            }
        }
    }
    if (var12 == PathType.FENCE) {
        var8 = a(var0, var1, var2);
        var8.i = true;
        var8.l = var12;
        var8.k = var12.a();
    }
    return var8;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_16_R3.AxisAlignedBB) PathPoint(net.minecraft.server.v1_16_R3.PathPoint) PathType(net.minecraft.server.v1_16_R3.PathType) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Aggregations

PathPoint (net.minecraft.server.v1_16_R3.PathPoint)12 PathPoint (net.minecraft.server.v1_14_R1.PathPoint)11 PathPoint (net.minecraft.server.v1_15_R1.PathPoint)11 List (java.util.List)10 Optional (java.util.Optional)9 Set (java.util.Set)9 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)9 PathPoint (net.minecraft.server.v1_13_R2.PathPoint)9 Vector (org.bukkit.util.Vector)9 Lists (com.google.common.collect.Lists)8 Sets (com.google.common.collect.Sets)8 Comparator (java.util.Comparator)8 Iterator (java.util.Iterator)8 Map (java.util.Map)8 Function (java.util.function.Function)8 Collectors (java.util.stream.Collectors)8 Stream (java.util.stream.Stream)8 Setting (net.citizensnpcs.Settings.Setting)8 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)8 BlockPosition (net.minecraft.server.v1_14_R1.BlockPosition)8