Search in sources :

Example 11 with PathType

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

the class PlayerPathfinderNormal method a.

private PathPoint a(int var1, int var2, int var3, int var4, double var5, EnumDirection var7) {
    PathPoint var8 = null;
    BlockPosition var9 = new BlockPosition(var1, var2, var3);
    double var10 = a(this.a, var9);
    if (var10 - var5 > 1.125D) {
        return null;
    } else {
        PathType var12 = this.a(this.b, var1, var2, var3);
        float var13 = this.b.a(var12);
        double var14 = this.b.width / 2.0D;
        if (var13 >= 0.0F) {
            var8 = this.a(var1, var2, var3);
            var8.m = var12;
            var8.l = Math.max(var8.l, var13);
        }
        if (var12 == PathType.WALKABLE) {
            return var8;
        } else {
            if (var8 == null && var4 > 0 && var12 != PathType.FENCE && var12 != PathType.TRAPDOOR) {
                var8 = this.a(var1, var2 + 1, var3, var4 - 1, var5, var7);
                if (var8 != null && (var8.m == PathType.OPEN || var8.m == PathType.WALKABLE) && this.b.width < 1.0F) {
                    double var16 = var1 - var7.getAdjacentX() + 0.5D;
                    double var18 = var3 - var7.getAdjacentZ() + 0.5D;
                    AxisAlignedBB var20 = new AxisAlignedBB(var16 - var14, var2 + 0.001D, var18 - var14, var16 + var14, this.b.length + a(this.a, var9.up()) - 0.002D, var18 + var14);
                    if (!this.b.world.getCubes((Entity) null, var20)) {
                        var8 = null;
                    }
                }
            }
            if (var12 == PathType.WATER && !this.e()) {
                if (this.a(this.b, var1, var2 - 1, var3) != PathType.WATER) {
                    return var8;
                }
                while (var2 > 0) {
                    --var2;
                    var12 = this.a(this.b, var1, var2, var3);
                    if (var12 != PathType.WATER) {
                        return var8;
                    }
                    var8 = this.a(var1, var2, var3);
                    var8.m = var12;
                    var8.l = Math.max(var8.l, this.b.a(var12));
                }
            }
            if (var12 == PathType.OPEN) {
                AxisAlignedBB var21 = new AxisAlignedBB(var1 - var14 + 0.5D, var2 + 0.001D, var3 - var14 + 0.5D, var1 + var14 + 0.5D, var2 + this.b.length, var3 + var14 + 0.5D);
                if (!this.b.world.getCubes((Entity) null, var21)) {
                    return null;
                }
                if (this.b.width >= 1.0F) {
                    PathType var17 = this.a(this.b, var1, var2 - 1, var3);
                    if (var17 == PathType.BLOCKED) {
                        var8 = this.a(var1, var2, var3);
                        var8.m = PathType.WALKABLE;
                        var8.l = Math.max(var8.l, var13);
                        return var8;
                    }
                }
                int var22 = 0;
                while (var2 > 0 && var12 == PathType.OPEN) {
                    --var2;
                    if (var22++ >= Setting.MC_NAVIGATION_MAX_FALL_DISTANCE.asInt()) {
                        return null;
                    }
                    var12 = this.a(this.b, var1, var2, var3);
                    var13 = this.b.a(var12);
                    if (var12 != PathType.OPEN && var13 >= 0.0F) {
                        var8 = this.a(var1, var2, var3);
                        var8.m = var12;
                        var8.l = Math.max(var8.l, var13);
                        break;
                    }
                    if (var13 < 0.0F) {
                        return null;
                    }
                }
            }
            return var8;
        }
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_13_R2.AxisAlignedBB) PathPoint(net.minecraft.server.v1_13_R2.PathPoint) PathType(net.minecraft.server.v1_13_R2.PathType) Entity(net.minecraft.server.v1_13_R2.Entity) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) PathPoint(net.minecraft.server.v1_13_R2.PathPoint)

Example 12 with PathType

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

the class PlayerPathfinderNormal method b.

@Override
public PathPoint b() {
    BlockPosition.MutableBlockPosition var1 = new BlockPosition.MutableBlockPosition();
    int var0 = MathHelper.floor(this.b.locY());
    IBlockData var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
    if (this.b.a(var2.getFluid().getType())) {
        while (this.b.a(var2.getFluid().getType())) {
            var0++;
            var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
        }
        var0--;
    } else if (e() && this.b.isInWater()) {
        while (var2.getBlock() == Blocks.WATER || var2.getFluid() == FluidTypes.WATER.a(false)) {
            var0++;
            var2 = this.a.getType(var1.c(this.b.locX(), var0, this.b.locZ()));
        }
        var0--;
    } else if (this.b.isOnGround()) {
        var0 = MathHelper.floor(this.b.locY() + 0.5D);
    } else {
        BlockPosition blockPosition = this.b.getChunkCoordinates();
        while ((this.a.getType(blockPosition).isAir() || this.a.getType(blockPosition).a(this.a, blockPosition, PathMode.LAND)) && blockPosition.getY() > 0) blockPosition = blockPosition.down();
        var0 = blockPosition.up().getY();
    }
    BlockPosition var3 = this.b.getChunkCoordinates();
    PathType var4 = a(this.b, var3.getX(), var0, var3.getZ());
    if (this.b.a(var4) < 0.0F) {
        AxisAlignedBB axisAlignedBB = this.b.getBoundingBox();
        if (b(var1.c(axisAlignedBB.minX, var0, axisAlignedBB.minZ)) || b(var1.c(axisAlignedBB.minX, var0, axisAlignedBB.maxZ)) || b(var1.c(axisAlignedBB.maxX, var0, axisAlignedBB.minZ)) || b(var1.c(axisAlignedBB.maxX, var0, axisAlignedBB.maxZ))) {
            PathPoint var6 = a(var1);
            var6.l = a(this.b, var6.a());
            var6.k = this.b.a(var6.l);
            return var6;
        }
    }
    PathPoint var5 = a(var3.getX(), var0, var3.getZ());
    var5.l = a(this.b, var5.a());
    var5.k = this.b.a(var5.l);
    return var5;
}
Also used : AxisAlignedBB(net.minecraft.server.v1_16_R3.AxisAlignedBB) PathType(net.minecraft.server.v1_16_R3.PathType) PathPoint(net.minecraft.server.v1_16_R3.PathPoint) IBlockData(net.minecraft.server.v1_16_R3.IBlockData) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 13 with PathType

use of net.minecraft.server.v1_14_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 = a(var0, var15, var16, var17);
                var18 = 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_16_R3.PathType) PathPoint(net.minecraft.server.v1_16_R3.PathPoint)

Example 14 with PathType

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

the class PlayerPathfinderNormal method a.

@Override
public PathType a(IBlockAccess var0, int var1, int var2, int var3, EntityInsentient var4, int var5, int var6, int var7, boolean var8, boolean var9) {
    EnumSet<PathType> var10 = EnumSet.noneOf(PathType.class);
    PathType var11 = PathType.BLOCKED;
    BlockPosition var12 = var4.getChunkCoordinates();
    var11 = a(var0, var1, var2, var3, var5, var6, var7, var8, var9, var10, var11, var12);
    if (var10.contains(PathType.FENCE))
        return PathType.FENCE;
    if (var10.contains(PathType.UNPASSABLE_RAIL))
        return PathType.UNPASSABLE_RAIL;
    PathType var13 = PathType.BLOCKED;
    for (PathType var15 : var10) {
        if (var4.a(var15) < 0.0F)
            return var15;
        if (var4.a(var15) >= var4.a(var13))
            var13 = var15;
    }
    if (var11 == PathType.OPEN && var4.a(var13) == 0.0F && var5 <= 1)
        return PathType.OPEN;
    return var13;
}
Also used : PathType(net.minecraft.server.v1_16_R3.PathType) BlockPosition(net.minecraft.server.v1_16_R3.BlockPosition)

Example 15 with PathType

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

Aggregations

PathType (net.minecraft.server.v1_10_R1.PathType)8 PathType (net.minecraft.server.v1_12_R1.PathType)8 PooledBlockPosition (net.minecraft.server.v1_14_R1.BlockPosition.PooledBlockPosition)8 PathType (net.minecraft.server.v1_14_R1.PathType)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_14_R1.BlockPosition)7 MutableBlockPosition (net.minecraft.server.v1_14_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