private void func_22181_a(File var1, ArrayList var2, int var3, int var4, IProgressUpdate var5) {
      Collections.sort(var2);
      byte[] var6 = new byte[4096];
      Iterator var7 = var2.iterator();

      while(var7.hasNext()) {
         ChunkFile var8 = (ChunkFile)var7.next();
         int var9 = var8.getXChunk();
         int var10 = var8.getYChunk();
         RegionFile var11 = RegionFileCache.createOrLoadRegionFile(var1, var9, var10);
         if(!var11.isChunkSaved(var9 & 31, var10 & 31)) {
            try {
               DataInputStream var12 = new DataInputStream(new GZIPInputStream(new FileInputStream(var8.getChunkFile())));
               DataOutputStream var13 = var11.getChunkDataOutputStream(var9 & 31, var10 & 31);
               boolean var14 = false;

               int var17;
               while((var17 = var12.read(var6)) != -1) {
                  var13.write(var6, 0, var17);
               }

               var13.close();
               var12.close();
            } catch (IOException var15) {
               var15.printStackTrace();
            }
         }

         ++var3;
         int var16 = (int)Math.round(100.0D * (double)var3 / (double)var4);
         var5.setLoadingProgress(var16);
      }

      RegionFileCache.clearRegionFileReferences();
   }