public void saveChunk(World var1, Chunk var2) throws IOException {
      var1.checkSessionLock();
      File var3 = this.chunkFileForXZ(var2.xPosition, var2.zPosition);
      if(var3.exists()) {
         WorldInfo var4 = var1.getWorldInfo();
         var4.setSizeOnDisk(var4.getSizeOnDisk() - var3.length());
      }

      try {
         File var10 = new File(this.saveDir, "tmp_chunk.dat");
         FileOutputStream var5 = new FileOutputStream(var10);
         NBTTagCompound var6 = new NBTTagCompound();
         NBTTagCompound var7 = new NBTTagCompound();
         var6.setTag("Level", var7);
         storeChunkInCompound(var2, var1, var7);
         CompressedStreamTools.writeGzippedCompoundToOutputStream(var6, var5);
         var5.close();
         if(var3.exists()) {
            var3.delete();
         }

         var10.renameTo(var3);
         WorldInfo var8 = var1.getWorldInfo();
         var8.setSizeOnDisk(var8.getSizeOnDisk() + var3.length());
      } catch (Exception var9) {
         var9.printStackTrace();
      }

   }