Search in sources :

Example 11 with BlockMinecartTrackAbstract

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

the class PlayerPathfinderNormal method b.

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

Example 12 with BlockMinecartTrackAbstract

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

the class PlayerPathfinderNormal method c.

protected static PathType c(IBlockAccess var0, int var1, int var2, int var3) {
    BlockPosition var4 = new BlockPosition(var1, var2, var3);
    IBlockData var5 = var0.getType(var4);
    Block var6 = var5.getBlock();
    Material var7 = var5.getMaterial();
    if (var5.isAir()) {
        return PathType.OPEN;
    } else if (!var6.a(TagsBlock.TRAPDOORS) && var6 != Blocks.LILY_PAD) {
        if (var6 == Blocks.FIRE) {
            return PathType.DAMAGE_FIRE;
        } else if (var6 == Blocks.CACTUS) {
            return PathType.DAMAGE_CACTUS;
        } else if (var6 == Blocks.SWEET_BERRY_BUSH) {
            return PathType.DAMAGE_OTHER;
        } else if (var6 == Blocks.HONEY_BLOCK) {
            return PathType.STICKY_HONEY;
        } else if (var6 == Blocks.COCOA) {
            return PathType.COCOA;
        } else if (var6 instanceof BlockDoor && var7 == Material.WOOD && !(Boolean) var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_WOOD_CLOSED;
        } else if (var6 instanceof BlockDoor && var7 == Material.ORE && !(Boolean) var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_IRON_CLOSED;
        } else if (var6 instanceof BlockDoor && var5.get(BlockDoor.OPEN)) {
            return PathType.DOOR_OPEN;
        } else if (var6 instanceof BlockMinecartTrackAbstract) {
            return PathType.RAIL;
        } else if (var6 instanceof BlockLeaves) {
            return PathType.LEAVES;
        } else if (var6.a(TagsBlock.FENCES) || var6.a(TagsBlock.WALLS) || var6 instanceof BlockFenceGate && !(Boolean) var5.get(BlockFenceGate.OPEN)) {
            return PathType.FENCE;
        } else {
            Fluid var8 = var0.getFluid(var4);
            if (var8.a(TagsFluid.WATER)) {
                return PathType.WATER;
            } else if (var8.a(TagsFluid.LAVA)) {
                return PathType.LAVA;
            } else {
                return var5.a(var0, var4, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED;
            }
        }
    } else {
        return PathType.TRAPDOOR;
    }
}
Also used : BlockDoor(net.minecraft.server.v1_15_R1.BlockDoor) IBlockData(net.minecraft.server.v1_15_R1.IBlockData) BlockLeaves(net.minecraft.server.v1_15_R1.BlockLeaves) BlockFenceGate(net.minecraft.server.v1_15_R1.BlockFenceGate) 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) Fluid(net.minecraft.server.v1_15_R1.Fluid) TagsFluid(net.minecraft.server.v1_15_R1.TagsFluid) Block(net.minecraft.server.v1_15_R1.Block) TagsBlock(net.minecraft.server.v1_15_R1.TagsBlock) Material(net.minecraft.server.v1_15_R1.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_15_R1.BlockMinecartTrackAbstract)

Example 13 with BlockMinecartTrackAbstract

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

the class PlayerPathfinderNormal method a.

public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, boolean paramBoolean1, boolean paramBoolean2, EnumSet<PathType> paramEnumSet, PathType paramPathType, BlockPosition paramBlockPosition) {
    for (int i = 0; i < paramInt4; i++) {
        for (int k = 0; k < paramInt5; k++) {
            for (int m = 0; m < paramInt6; m++) {
                int n = i + paramInt1;
                int i1 = k + paramInt2;
                int i2 = m + paramInt3;
                PathType localPathType = a(paramIBlockAccess, n, i1, i2);
                if ((localPathType == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
                    localPathType = PathType.WALKABLE;
                }
                if ((localPathType == PathType.DOOR_OPEN) && (!paramBoolean2)) {
                    localPathType = PathType.BLOCKED;
                }
                if ((localPathType == PathType.RAIL) && (!(paramIBlockAccess.getType(paramBlockPosition).getBlock() instanceof BlockMinecartTrackAbstract)) && (!(paramIBlockAccess.getType(paramBlockPosition.down()).getBlock() instanceof BlockMinecartTrackAbstract))) {
                    localPathType = PathType.FENCE;
                }
                if ((i == 0) && (k == 0) && (m == 0)) {
                    paramPathType = localPathType;
                }
                paramEnumSet.add(localPathType);
            }
        }
    }
    return paramPathType;
}
Also used : PathType(net.minecraft.server.v1_12_R1.PathType) BlockMinecartTrackAbstract(net.minecraft.server.v1_12_R1.BlockMinecartTrackAbstract) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Example 14 with BlockMinecartTrackAbstract

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

the class PlayerPathfinderNormal method b.

protected PathType b(IBlockAccess var1, int var2, int var3, int var4) {
    BlockPosition var5 = new BlockPosition(var2, var3, var4);
    IBlockData var6 = var1.getType(var5);
    Block var7 = var6.getBlock();
    Material var8 = var6.getMaterial();
    if (var6.isAir()) {
        return PathType.OPEN;
    } else if (var7 != Blocks.OAK_TRAPDOOR && var7 != Blocks.IRON_TRAPDOOR && var7 != Blocks.LILY_PAD) {
        if (var7 == Blocks.FIRE) {
            return PathType.DAMAGE_FIRE;
        } else if (var7 == Blocks.CACTUS) {
            return PathType.DAMAGE_CACTUS;
        } else if (var7 instanceof BlockDoor && var8 == Material.WOOD && !var6.get(BlockDoor.OPEN).booleanValue()) {
            return PathType.DOOR_WOOD_CLOSED;
        } else if (var7 instanceof BlockDoor && var8 == Material.ORE && !var6.get(BlockDoor.OPEN).booleanValue()) {
            return PathType.DOOR_IRON_CLOSED;
        } else if (var7 instanceof BlockDoor && var6.get(BlockDoor.OPEN).booleanValue()) {
            return PathType.DOOR_OPEN;
        } else if (var7 instanceof BlockMinecartTrackAbstract) {
            return PathType.RAIL;
        } else if (var7 instanceof BlockFence || var7 instanceof BlockCobbleWall || var7 instanceof BlockFenceGate && !var6.get(BlockFenceGate.OPEN).booleanValue()) {
            return PathType.FENCE;
        } else {
            Fluid var9;
            try {
                var9 = var1.getFluid(var5);
            } catch (NoSuchMethodError ex) {
                try {
                    var9 = (Fluid) GET_FLUID.invoke(var1, var5);
                } catch (Throwable ex2) {
                    ex2.printStackTrace();
                    return PathType.BLOCKED;
                }
            }
            if (var9.a(TagsFluid.WATER)) {
                return PathType.WATER;
            } else if (var9.a(TagsFluid.LAVA)) {
                return PathType.LAVA;
            } else {
                return var6.a(var1, var5, PathMode.LAND) ? PathType.OPEN : PathType.BLOCKED;
            }
        }
    } else {
        return PathType.TRAPDOOR;
    }
}
Also used : BlockDoor(net.minecraft.server.v1_13_R2.BlockDoor) IBlockData(net.minecraft.server.v1_13_R2.IBlockData) BlockFenceGate(net.minecraft.server.v1_13_R2.BlockFenceGate) BlockCobbleWall(net.minecraft.server.v1_13_R2.BlockCobbleWall) MutableBlockPosition(net.minecraft.server.v1_13_R2.BlockPosition.MutableBlockPosition) BlockPosition(net.minecraft.server.v1_13_R2.BlockPosition) TagsFluid(net.minecraft.server.v1_13_R2.TagsFluid) Fluid(net.minecraft.server.v1_13_R2.Fluid) Block(net.minecraft.server.v1_13_R2.Block) Material(net.minecraft.server.v1_13_R2.Material) BlockMinecartTrackAbstract(net.minecraft.server.v1_13_R2.BlockMinecartTrackAbstract) BlockFence(net.minecraft.server.v1_13_R2.BlockFence)

Aggregations

BlockMinecartTrackAbstract (net.minecraft.server.v1_10_R1.BlockMinecartTrackAbstract)3 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)3 MutableBlockPosition (net.minecraft.server.v1_10_R1.BlockPosition.MutableBlockPosition)3 PathType (net.minecraft.server.v1_10_R1.PathType)3 BlockMinecartTrackAbstract (net.minecraft.server.v1_11_R1.BlockMinecartTrackAbstract)3 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 AxisAlignedBB (net.minecraft.server.v1_10_R1.AxisAlignedBB)2 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)2 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)2 PathType (net.minecraft.server.v1_11_R1.PathType)2 BlockMinecartTrackAbstract (net.minecraft.server.v1_12_R1.BlockMinecartTrackAbstract)2 BlockMinecartTrackAbstract (net.minecraft.server.v1_13_R2.BlockMinecartTrackAbstract)2 Block (net.minecraft.server.v1_10_R1.Block)1 BlockCobbleWall (net.minecraft.server.v1_10_R1.BlockCobbleWall)1 BlockDoor (net.minecraft.server.v1_10_R1.BlockDoor)1 BlockFence (net.minecraft.server.v1_10_R1.BlockFence)1 BlockFenceGate (net.minecraft.server.v1_10_R1.BlockFenceGate)1 IBlockData (net.minecraft.server.v1_10_R1.IBlockData)1 Material (net.minecraft.server.v1_10_R1.Material)1