private void func_22181_a(
      File file, ArrayList arraylist, int i, int j, IProgressUpdate iprogressupdate) {
    Collections.sort(arraylist);
    byte abyte0[] = new byte[4096];
    int i1;
    for (Iterator iterator = arraylist.iterator();
        iterator.hasNext();
        iprogressupdate.setLoadingProgress(i1)) {
      ChunkFile chunkfile = (ChunkFile) iterator.next();
      int k = chunkfile.func_22323_b();
      int l = chunkfile.func_22321_c();
      RegionFile regionfile = RegionFileCache.func_22193_a(file, k, l);
      if (!regionfile.func_22202_c(k & 0x1f, l & 0x1f)) {
        try {
          DataInputStream datainputstream =
              new DataInputStream(
                  new GZIPInputStream(new FileInputStream(chunkfile.func_22324_a())));
          DataOutputStream dataoutputstream =
              regionfile.getChunkDataOutputStream(k & 0x1f, l & 0x1f);
          for (int j1 = 0; (j1 = datainputstream.read(abyte0)) != -1; ) {
            dataoutputstream.write(abyte0, 0, j1);
          }

          dataoutputstream.close();
          datainputstream.close();
        } catch (IOException ioexception) {
          ioexception.printStackTrace();
        }
      }
      i++;
      i1 = (int) Math.round((100D * (double) i) / (double) j);
    }

    RegionFileCache.func_22192_a();
  }
示例#2
0
  public void importOldChunkTileEntities() {
    File file = wc.downloadSaveHandler.getSaveDirectory();
    if (wc.worldProvider instanceof WorldProviderHell) {
      file = new File(file, "DIM-1");
      file.mkdirs();
    }

    java.io.DataInputStream datainputstream =
        RegionFileCache.getChunkInputStream(file, xPosition, zPosition);
    NBTTagCompound nbttagcompound;
    if (datainputstream != null) {
      try {
        nbttagcompound = CompressedStreamTools.func_1141_a(datainputstream);
      } catch (IOException e) {
        return;
      }
    } else return;

    if (!nbttagcompound.hasKey("Level")) return;

    NBTTagList nbttaglist1 = nbttagcompound.getCompoundTag("Level").getTagList("TileEntities");
    if (nbttaglist1 != null) {
      for (int l = 0; l < nbttaglist1.tagCount(); l++) {
        NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.tagAt(l);
        TileEntity te = TileEntity.createAndLoadEntity(nbttagcompound2);
        if (te != null) {
          ChunkPosition cp = new ChunkPosition(te.xCoord & 0xf, te.yCoord, te.zCoord & 0xf);
          newChunkTileEntityMap.put(cp, te);
        }
      }
    }
  }
 public void flushCache() {
   RegionFileCache.func_22192_a();
 }
 public void flushCache() {
   RegionFileCache.clearRegionFileReferences();
 }