public static ChunkCoordinates getNearestEmptyChunkCoordinates(World par0World, int par1, int par2, int par3, int par4)
    {
        int i = par0World.getBlockMetadata(par1, par2, par3);
        int j = BlockDirectional.getDirection(i);

        for (int k = 0; k <= 1; k++)
        {
            int l = par1 - headBlockToFootBlockMap[j][0] * k - 1;
            int i1 = par3 - headBlockToFootBlockMap[j][1] * k - 1;
            int j1 = l + 2;
            int k1 = i1 + 2;

            for (int l1 = l; l1 <= j1; l1++)
            {
                for (int i2 = i1; i2 <= k1; i2++)
                {
                    if (!par0World.func_72797_t(l1, par2 - 1, i2) || !par0World.isAirBlock(l1, par2, i2) || !par0World.isAirBlock(l1, par2 + 1, i2))
                    {
                        continue;
                    }

                    if (par4 > 0)
                    {
                        par4--;
                    }
                    else
                    {
                        return new ChunkCoordinates(l1, par2, i2);
                    }
                }
            }
        }

        return null;
    }