Search in sources :

Example 26 with PathType

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

the class PlayerPathfinderNormal method getPathTypeBase.

public PathType getPathTypeBase(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
    BlockPosition localBlockPosition = new BlockPosition(paramInt1, paramInt2, paramInt3);
    IBlockData localIBlockData = paramIBlockAccess.getType(localBlockPosition);
    Block localBlock1 = localIBlockData.getBlock();
    Material localMaterial = localIBlockData.getMaterial();
    PathType localPathType1 = PathType.BLOCKED;
    if ((localBlock1 == Blocks.TRAPDOOR) || (localBlock1 == Blocks.IRON_TRAPDOOR) || (localBlock1 == Blocks.WATERLILY)) {
        return PathType.TRAPDOOR;
    }
    if (localBlock1 == Blocks.FIRE) {
        return PathType.DAMAGE_FIRE;
    }
    if (localBlock1 == Blocks.CACTUS) {
        return PathType.DAMAGE_CACTUS;
    }
    if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.WOOD) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_WOOD_CLOSED;
    }
    if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.ORE) && (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_IRON_CLOSED;
    }
    if (((localBlock1 instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
        return PathType.DOOR_OPEN;
    }
    if ((localBlock1 instanceof BlockMinecartTrackAbstract)) {
        return PathType.RAIL;
    }
    if (((localBlock1 instanceof BlockFence)) || ((localBlock1 instanceof BlockCobbleWall)) || (((localBlock1 instanceof BlockFenceGate)) && (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
        return PathType.FENCE;
    }
    if (localMaterial == Material.AIR) {
        localPathType1 = PathType.OPEN;
    } else {
        if (localMaterial == Material.WATER) {
            return PathType.WATER;
        }
        if (localMaterial == Material.LAVA) {
            return PathType.LAVA;
        }
    }
    if ((localBlock1.b(paramIBlockAccess, localBlockPosition)) && (localPathType1 == PathType.BLOCKED)) {
        localPathType1 = PathType.OPEN;
    }
    return localPathType1;
}
Also used : BlockDoor(net.minecraft.server.v1_10_R1.BlockDoor) PathType(net.minecraft.server.v1_10_R1.PathType) IBlockData(net.minecraft.server.v1_10_R1.IBlockData) BlockFenceGate(net.minecraft.server.v1_10_R1.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_10_R1.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_10_R1.BlockPosition) Block(net.minecraft.server.v1_10_R1.Block) Material(net.minecraft.server.v1_10_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_10_R1.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_10_R1.BlockFence)

Example 27 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 = 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 28 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() {
    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 29 with PathType

use of net.minecraft.server.v1_15_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 30 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 j = paramInt1 - paramInt4 / 2;
    int k = paramInt3 - paramInt6 / 2;
    if (!b(j, paramInt2, k, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
        return false;
    }
    for (int m = j; m < j + paramInt4; m++) {
        for (int n = k; n < k + paramInt6; n++) {
            double d1 = m + 0.5D - paramVec3D.x;
            double d2 = n + 0.5D - paramVec3D.z;
            if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
                PathType localPathType = this.h.a(this.b, m, paramInt2 - 1, n, 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.h.a(this.b, m, paramInt2, n, this.a, paramInt4, paramInt5, paramInt6, true, true);
                float f = this.a.a(localPathType);
                if ((f < 0.0F) || (f >= 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_12_R1.PathType) 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 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