Search in sources :

Example 46 with PathType

use of net.minecraft.server.v1_15_R1.PathType 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) {
    PathPoint var7 = null;
    BlockPosition var8 = new BlockPosition(var0, var1, var2);
    double var9 = a(this.a, var8);
    if (var9 - var4 > 1.125D) {
        return null;
    } else {
        PathType var11 = this.a(this.b, var0, var1, var2);
        float var12 = this.b.a(var11);
        double var13 = this.b.getWidth() / 2.0D;
        if (var12 >= 0.0F) {
            var7 = this.a(var0, var1, var2);
            var7.l = var11;
            var7.k = Math.max(var7.k, var12);
        }
        if (var11 == PathType.WALKABLE) {
            return var7;
        } else {
            if ((var7 == null || var7.k < 0.0F) && var3 > 0 && var11 != PathType.FENCE && var11 != PathType.TRAPDOOR) {
                var7 = this.a(var0, var1 + 1, var2, var3 - 1, var4, var6);
                if (var7 != null && (var7.l == PathType.OPEN || var7.l == PathType.WALKABLE) && this.b.getWidth() < 1.0F) {
                    double var15 = var0 - var6.getAdjacentX() + 0.5D;
                    double var17 = var2 - var6.getAdjacentZ() + 0.5D;
                    AxisAlignedBB var19 = new AxisAlignedBB(var15 - var13, a(this.a, (new BlockPosition(var15, var1 + 1, var17))) + 0.001D, var17 - var13, var15 + var13, this.b.getHeight() + a(this.a, (new BlockPosition(var7.a, var7.b, var7.c))) - 0.002D, var17 + var13);
                    if (!this.a.getCubes(this.b, var19)) {
                        var7 = null;
                    }
                }
            }
            if (var11 == PathType.WATER && !this.e()) {
                if (this.a(this.b, var0, var1 - 1, var2) != PathType.WATER) {
                    return var7;
                }
                while (var1 > 0) {
                    --var1;
                    var11 = this.a(this.b, var0, var1, var2);
                    if (var11 != PathType.WATER) {
                        return var7;
                    }
                    var7 = this.a(var0, var1, var2);
                    var7.l = var11;
                    var7.k = Math.max(var7.k, this.b.a(var11));
                }
            }
            if (var11 == PathType.OPEN) {
                AxisAlignedBB var15 = new AxisAlignedBB(var0 - var13 + 0.5D, var1 + 0.001D, var2 - var13 + 0.5D, var0 + var13 + 0.5D, var1 + this.b.getHeight(), var2 + var13 + 0.5D);
                if (!this.a.getCubes(this.b, var15)) {
                    return null;
                }
                if (this.b.getWidth() >= 1.0F) {
                    PathType var16 = this.a(this.b, var0, var1 - 1, var2);
                    if (var16 == PathType.BLOCKED) {
                        var7 = this.a(var0, var1, var2);
                        var7.l = PathType.WALKABLE;
                        var7.k = Math.max(var7.k, var12);
                        return var7;
                    }
                }
                int var16 = 0;
                int var17 = var1;
                while (var11 == PathType.OPEN) {
                    --var1;
                    PathPoint var18;
                    if (var1 < 0) {
                        var18 = this.a(var0, var17, var2);
                        var18.l = PathType.BLOCKED;
                        var18.k = -1.0F;
                        return var18;
                    }
                    var18 = this.a(var0, var1, var2);
                    if (var16++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
                        var18.l = PathType.BLOCKED;
                        var18.k = -1.0F;
                        return var18;
                    }
                    var11 = this.a(this.b, var0, var1, var2);
                    var12 = this.b.a(var11);
                    if (var11 != PathType.OPEN && var12 >= 0.0F) {
                        var7 = var18;
                        var18.l = var11;
                        var18.k = Math.max(var18.k, var12);
                        break;
                    }
                    if (var12 < 0.0F) {
                        var18.l = PathType.BLOCKED;
                        var18.k = -1.0F;
                        return var18;
                    }
                }
            }
            return var7;
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_15_R1.AxisAlignedBB) PathPoint(net.minecraft.server.v1_15_R1.PathPoint) PathType(net.minecraft.server.v1_15_R1.PathType) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition) PooledBlockPosition(net.minecraft.server.v1_15_R1.BlockPosition.PooledBlockPosition) PathPoint(net.minecraft.server.v1_15_R1.PathPoint)

Example 47 with PathType

use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

public PathType a(IBlockAccess var0, int var1, int var2, int var3, int var4, int var5, int var6, boolean var7, boolean var8, EnumSet<PathType> var9, PathType var10, BlockPosition var11) {
    for (int var12 = 0; var12 < var4; ++var12) {
        for (int var13 = 0; var13 < var5; ++var13) {
            for (int var14 = 0; var14 < var6; ++var14) {
                int var15 = var12 + var1;
                int var16 = var13 + var2;
                int var17 = var14 + var3;
                PathType var18 = this.a(var0, var15, var16, var17);
                var18 = this.a(var0, var7, var8, var11, var18);
                if (var12 == 0 && var13 == 0 && var14 == 0) {
                    var10 = var18;
                }
                var9.add(var18);
            }
        }
    }
    return var10;
}
Also used : PathType(net.minecraft.server.v1_15_R1.PathType) PathPoint(net.minecraft.server.v1_15_R1.PathPoint)

Example 48 with PathType

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

use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method a.

@Override
public int a(PathPoint[] paramArrayOfPathPoint, PathPoint paramPathPoint1, PathPoint paramPathPoint2, float paramFloat) {
    int i = 0;
    int k = 0;
    PathType localPathType = a(this.b, paramPathPoint1.a, paramPathPoint1.b + 1, paramPathPoint1.c);
    if (this.b.a(localPathType) >= 0.0F) {
        k = MathHelper.d(Math.max(1.0F, this.b.P));
    }
    BlockPosition localBlockPosition = new BlockPosition(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c).down();
    double d = paramPathPoint1.b - (1.0D - this.a.getType(localBlockPosition).d(this.a, localBlockPosition).e);
    PathPoint localPathPoint1 = a(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
    PathPoint localPathPoint2 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c, k, d, EnumDirection.WEST);
    PathPoint localPathPoint3 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c, k, d, EnumDirection.EAST);
    PathPoint localPathPoint4 = a(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
    if ((localPathPoint1 != null) && (!localPathPoint1.i) && (localPathPoint1.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint1;
    }
    if ((localPathPoint2 != null) && (!localPathPoint2.i) && (localPathPoint2.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint2;
    }
    if ((localPathPoint3 != null) && (!localPathPoint3.i) && (localPathPoint3.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint3;
    }
    if ((localPathPoint4 != null) && (!localPathPoint4.i) && (localPathPoint4.a(paramPathPoint2) < paramFloat)) {
        paramArrayOfPathPoint[(i++)] = localPathPoint4;
    }
    int m = (localPathPoint4 == null) || (localPathPoint4.m == PathType.OPEN) || (localPathPoint4.l != 0.0F) ? 1 : 0;
    int n = (localPathPoint1 == null) || (localPathPoint1.m == PathType.OPEN) || (localPathPoint1.l != 0.0F) ? 1 : 0;
    int i1 = (localPathPoint3 == null) || (localPathPoint3.m == PathType.OPEN) || (localPathPoint3.l != 0.0F) ? 1 : 0;
    int i2 = (localPathPoint2 == null) || (localPathPoint2.m == PathType.OPEN) || (localPathPoint2.l != 0.0F) ? 1 : 0;
    PathPoint localPathPoint5;
    if ((m != 0) && (i2 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    if ((m != 0) && (i1 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d, EnumDirection.NORTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    if ((n != 0) && (i2 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    if ((n != 0) && (i1 != 0)) {
        localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d, EnumDirection.SOUTH);
        if ((localPathPoint5 != null) && (!localPathPoint5.i) && (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
            paramArrayOfPathPoint[(i++)] = localPathPoint5;
        }
    }
    return i;
}
Also used : PathType(net.minecraft.server.v1_11_R1.PathType) PathPoint(net.minecraft.server.v1_11_R1.PathPoint) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 50 with PathType

use of net.minecraft.server.v1_15_R1.PathType in project Citizens2 by CitizensDev.

the class PlayerPathfinderNormal method b.

@Override
public PathPoint b() {
    int i;
    BlockPosition localObject1;
    if ((e()) && (this.b.isInWater())) {
        i = (int) this.b.getBoundingBox().b;
        localObject1 = new BlockPosition.MutableBlockPosition(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
        Block localObject2 = this.a.getType(localObject1).getBlock();
        while ((localObject2 == Blocks.FLOWING_WATER) || (localObject2 == Blocks.WATER)) {
            i++;
            ((MutableBlockPosition) localObject1).c(MathHelper.floor(this.b.locX), i, MathHelper.floor(this.b.locZ));
            localObject2 = this.a.getType(localObject1).getBlock();
        }
    } else if (this.b.onGround) {
        i = MathHelper.floor(this.b.getBoundingBox().b + 0.5D);
    } else {
        localObject1 = new BlockPosition(this.b);
        while (((this.a.getType(localObject1).getMaterial() == Material.AIR) || (this.a.getType(localObject1).getBlock().b(this.a, localObject1))) && (localObject1.getY() > 0)) {
            localObject1 = localObject1.down();
        }
        i = localObject1.up().getY();
    }
    localObject1 = new BlockPosition(this.b);
    Object localObject2 = a(this.b, localObject1.getX(), i, localObject1.getZ());
    if (this.b.a((PathType) localObject2) < 0.0F) {
        HashSet<BlockPosition> localHashSet = Sets.newHashSet();
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().c));
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().f));
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().c));
        localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().f));
        for (BlockPosition localBlockPosition : localHashSet) {
            PathType localPathType = a(this.b, localBlockPosition);
            if (this.b.a(localPathType) >= 0.0F) {
                return a(localBlockPosition.getX(), localBlockPosition.getY(), localBlockPosition.getZ());
            }
        }
    }
    return a(localObject1.getX(), i, localObject1.getZ());
}
Also used : PathType(net.minecraft.server.v1_11_R1.PathType) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_11_R1.BlockPosition) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) Block(net.minecraft.server.v1_11_R1.Block) MutableBlockPosition(net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Aggregations

PathType (net.minecraft.server.v1_10_R1.PathType)8 PathType (net.minecraft.server.v1_12_R1.PathType)8 PathType (net.minecraft.server.v1_14_R1.PathType)8 PooledBlockPosition (net.minecraft.server.v1_15_R1.BlockPosition.PooledBlockPosition)8 PathType (net.minecraft.server.v1_15_R1.PathType)8 PathType (net.minecraft.server.v1_16_R3.PathType)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)7 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)7 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)7 PathType (net.minecraft.server.v1_11_R1.PathType)7 PathType (net.minecraft.server.v1_13_R2.PathType)7 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_15_R1.BlockPosition.MutableBlockPosition)7 Iterator (java.util.Iterator)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)6 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)6 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)6 BlockPosition (net.minecraft.server.v1_13_R2.BlockPosition)6