Example #1
0
        public virtual bool SaveChunks(bool flag, net.minecraft.src.IProgressUpdate iprogressupdate
                                       )
        {
            int i = 0;

            for (int j = 0; j < field_28064_f.Count; j++)
            {
                net.minecraft.src.Chunk chunk = (net.minecraft.src.Chunk)field_28064_f[j];
                if (flag && !chunk.neverSave)
                {
                    Func_28060_a(chunk);
                }
                if (!chunk.NeedsSaving(flag))
                {
                    continue;
                }
                Func_28059_b(chunk);
                chunk.isModified = false;
                if (++i == 24 && !flag)
                {
                    return(false);
                }
            }
            if (flag)
            {
                if (field_28066_d == null)
                {
                    return(true);
                }
                field_28066_d.SaveExtraData();
            }
            return(true);
        }
Example #2
0
        public virtual bool SaveChunks(bool flag, net.minecraft.src.IProgressUpdate iprogressupdate
                                       )
        {
            int i = 0;

            for (int j = 0; j < field_727_f.Count; j++)
            {
                net.minecraft.src.Chunk chunk = (net.minecraft.src.Chunk)field_727_f[j];
                if (flag && !chunk.neverSave)
                {
                    SaveChunkExtraData(chunk);
                }
                if (!chunk.NeedsSaving(flag))
                {
                    continue;
                }
                SaveChunkViaChunkLoader(chunk);
                chunk.isModified = false;
                if (++i == 24 && !flag)
                {
                    return(false);
                }
            }
            if (flag)
            {
                if (chunkLoader == null)
                {
                    return(true);
                }
                chunkLoader.SaveExtraData();
            }
            return(true);
        }
Example #3
0
        public override bool ConverMapToMCRegion(string s, net.minecraft.src.IProgressUpdate
                                                 iprogressupdate)
        {
            iprogressupdate.SetLoadingProgress(0);
            List <ChunkFile> arraylist  = new List <ChunkFile>();
            List <string>    arraylist1 = new List <string>();
            List <ChunkFile> arraylist2 = new List <ChunkFile>();
            List <string>    arraylist3 = new List <string>();
            string           file       = System.IO.Path.Combine(field_22106_a, s);
            string           file1      = System.IO.Path.Combine(file, "DIM-1");

            System.Console.Out.WriteLine("Scanning folders...");
            Func_22108_a(file, arraylist, arraylist1);
            if (File.Exists(file1))
            {
                Func_22108_a(file1, arraylist2, arraylist3);
            }
            int i = arraylist.Count + arraylist2.Count + arraylist1.Count + arraylist3.Count;

            System.Console.Out.WriteLine((new java.lang.StringBuilder()).Append("Total conversion count is ").Append(i).ToString());
            Func_22107_a(file, arraylist, 0, i, iprogressupdate);
            Func_22107_a(file1, arraylist2, arraylist.Count, i, iprogressupdate);
            net.minecraft.src.WorldInfo worldinfo = GetWorldInfo(s);
            worldinfo.SetVersion(19132);
            net.minecraft.src.ISaveHandler isavehandler = Func_22105_a(s, true);
            isavehandler.Func_22094_a(worldinfo);
            Func_22109_a(arraylist1, arraylist.Count + arraylist2.Count, i, iprogressupdate);
            if (File.Exists(file1))
            {
                Func_22109_a(arraylist3, arraylist.Count + arraylist2.Count + arraylist1.Count, i
                             , iprogressupdate);
            }
            return(true);
        }
Example #4
0
        private void Func_22109_a(List <string> arraylist, int i, int j, net.minecraft.src.IProgressUpdate iprogressupdate)
        {
            int k;

            for (System.Collections.IEnumerator iterator = arraylist.GetEnumerator(); iterator
                 .MoveNext(); iprogressupdate.SetLoadingProgress(k))
            {
                string   file  = (string)iterator.Current;
                string[] afile = System.IO.Directory.GetFiles(file);
                Func_22104_a(afile);
                System.IO.File.Delete(file);
                i++;
                k = (int)System.Math.Round((100D * (double)i) / (double)j);
            }
        }
 public virtual bool SaveChunks(bool flag, net.minecraft.src.IProgressUpdate iprogressupdate
                                )
 {
     return(true);
 }
Example #6
0
        private void Func_22107_a(string file, List <ChunkFile> arraylist, int i, int j, net.minecraft.src.IProgressUpdate iprogressupdate)
        {
            arraylist.Sort();
            byte[] abyte0 = new byte[4096];
            int    i1;

            for (System.Collections.IEnumerator iterator = arraylist.GetEnumerator(); iterator
                 .MoveNext(); iprogressupdate.SetLoadingProgress(i1))
            {
                net.minecraft.src.ChunkFile chunkfile = (net.minecraft.src.ChunkFile)iterator.Current;
                int k = chunkfile.Func_22205_b();
                int l = chunkfile.Func_22204_c();
                net.minecraft.src.RegionFile regionfile = net.minecraft.src.RegionFileCache.Func_22123_a
                                                              (file, k, l);
                if (!regionfile.IsChunkSaved(k & 0x1f, l & 0x1f))
                {
                    try
                    {
                        using (FileStream fs = File.OpenRead(chunkfile.Func_22207_a()))
                            using (GZipStream ds = new GZipStream(fs, CompressionMode.Decompress))
                            {
                                java.io.DataInputStream datainputstream = new java.io.DataInputStream(ds);
                                //java.io.DataInputStream datainputstream = new java.io.DataInputStream(new java.util.zip.GZIPInputStream(new java.io.FileInputStream(chunkfile.Func_22207_a())));
                                java.io.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 (System.IO.IOException ioexception)
                    {
                        Sharpen.Runtime.PrintStackTrace(ioexception);
                    }
                }
                i++;
                i1 = (int)System.Math.Round((100D * (double)i) / (double)j);
            }
            net.minecraft.src.RegionFileCache.Func_22122_a();
        }
Example #7
0
 public virtual bool ConverMapToMCRegion(string s, net.minecraft.src.IProgressUpdate
                                         iprogressupdate)
 {
     return(false);
 }