public BiomeCache(WorldChunkManager par1WorldChunkManager)
 {
     LastCleanupTime = 0L;
     CacheMap        = new LongHashMap();
     Cache           = new List <BiomeCacheBlock>();
     ChunkManager    = par1WorldChunkManager;
 }
Exemplo n.º 2
0
 public ComponentVillageStartPiece(WorldChunkManager par1WorldChunkManager, int par2, Random par3Random, int par4, int par5, List <StructureVillagePieceWeight> par6ArrayList, int par7)
     : base(0, par3Random, par4, par5)
 {
     Field_35108_e  = new List <StructureComponent>();
     Field_35106_f  = new List <StructureComponent>();
     WorldChunkMngr = par1WorldChunkManager;
     StructureVillageWeightedPieceList = par6ArrayList;
     TerrainType = par7;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Converts the specified map to the new map format. Args: worldName, loadingScreen
        /// </summary>
        public override bool ConvertMapFormat(string par1Str, IProgressUpdate par2IProgressUpdate)
        {
            par2IProgressUpdate.SetLoadingProgress(0);
            List <string> arraylist  = new List <string>();
            List <string> arraylist1 = new List <string>();
            List <string> arraylist2 = new List <string>();
            string        file       = IOPath.Combine(SavesDirectory, par1Str);
            string        file1      = IOPath.Combine(file, "DIM-1");
            string        file2      = IOPath.Combine(file, "DIM1");

            Console.WriteLine("Scanning folders...");
            Func_48432_a(file, arraylist);

            if (File.Exists(file1))
            {
                Func_48432_a(file1, arraylist1);
            }

            if (File.Exists(file2))
            {
                Func_48432_a(file2, arraylist2);
            }

            int i = arraylist.Count + arraylist1.Count + arraylist2.Count;

            Console.WriteLine((new StringBuilder()).Append("Total conversion count is ").Append(i).ToString());
            WorldInfo worldinfo = GetWorldInfo(par1Str);
            object    obj       = null;

            if (worldinfo.GetTerrainType() == WorldType.FLAT)
            {
                obj = new WorldChunkManagerHell(BiomeGenBase.Plains, 0.5F, 0.5F);
            }
            else
            {
                obj = new WorldChunkManager(worldinfo.GetSeed(), worldinfo.GetTerrainType());
            }

            Func_48428_a(IOPath.Combine(file, "region"), arraylist, ((WorldChunkManager)(obj)), 0, i, par2IProgressUpdate);
            Func_48428_a(IOPath.Combine(file1, "region"), arraylist1, new WorldChunkManagerHell(BiomeGenBase.Hell, 1.0F, 0.0F), arraylist.Count, i, par2IProgressUpdate);
            Func_48428_a(IOPath.Combine(file2, "region"), arraylist2, new WorldChunkManagerHell(BiomeGenBase.Sky, 0.5F, 0.0F), arraylist.Count + arraylist1.Count, i, par2IProgressUpdate);
            worldinfo.SetSaveVersion(19133);

            if (worldinfo.GetTerrainType() == WorldType.DEFAULT_1_1)
            {
                worldinfo.SetTerrainType(WorldType.DEFAULT);
            }

            createFile(par1Str);
            ISaveHandler isavehandler = GetSaveLoader(par1Str, false);

            isavehandler.SaveWorldInfo(worldinfo);
            return(true);
        }
Exemplo n.º 4
0
 private void Func_48428_a(string par1File, List <string> par2ArrayList, WorldChunkManager par3WorldChunkManager, int par4, int par5, IProgressUpdate par6IProgressUpdate)
 {
     for (int i = 0; i < par2ArrayList.Count; i++)
     {
         par6IProgressUpdate.SetLoadingProgress(i);
         string file = par2ArrayList[i];
         Func_48430_a(par1File, file, par3WorldChunkManager, par4, par5, par6IProgressUpdate);
         par4++;
         i = (int)Math.Round((100D * (double)par4) / (double)par5);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// creates a new world chunk manager for WorldProvider
 /// </summary>
 public virtual void RegisterWorldChunkManager()
 {
     if (WorldObj.GetWorldInfo().GetTerrainType() == WorldType.FLAT)
     {
         WorldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.Plains, 0.5F, 0.5F);
     }
     else
     {
         WorldChunkMgr = new WorldChunkManager(WorldObj);
     }
 }
Exemplo n.º 6
0
        public virtual BiomeGenBase Func_48490_a(int par1, int par2, WorldChunkManager par3WorldChunkManager)
        {
            int i = blockBiomeArray[par2 << 4 | par1] & 0xff;

            if (i == 255)
            {
                BiomeGenBase biomegenbase = par3WorldChunkManager.GetBiomeGenAt((XPosition << 4) + par1, (ZPosition << 4) + par2);
                i = biomegenbase.BiomeID;
                blockBiomeArray[par2 << 4 | par1] = (byte)(i & 0xff);
            }

            if (BiomeGenBase.BiomeList[i] == null)
            {
                return(BiomeGenBase.Plains);
            }
            else
            {
                return(BiomeGenBase.BiomeList[i]);
            }
        }
Exemplo n.º 7
0
        private void Func_48430_a(string par1File, string par2File, WorldChunkManager par3WorldChunkManager, int par4, int par5, IProgressUpdate par6IProgressUpdate)
        {
            try
            {
                FileInfo   file        = new FileInfo(par2File);
                string     s           = file.Name;
                RegionFile regionfile  = new RegionFile(par2File);
                RegionFile regionfile1 = new RegionFile(IOPath.Combine(par1File, (new StringBuilder()).Append(s.Substring(0, s.Length - ".mcr".Length)).Append(".mca").ToString()));

                for (int i = 0; i < 32; i++)
                {
                    for (int j = 0; j < 32; j++)
                    {
                        if (!regionfile.IsChunkSaved(i, j) || regionfile1.IsChunkSaved(i, j))
                        {
                            continue;
                        }

                        Stream datainputstream = regionfile.GetChunkFileStream(i, j);

                        if (datainputstream == null)
                        {
                            Console.WriteLine("Failed to fetch input stream");
                        }
                        else
                        {
                            NBTTagCompound nbttagcompound = CompressedStreamTools.Read(new BinaryReader(datainputstream));
                            datainputstream.Close();

                            NBTTagCompound nbttagcompound1 = nbttagcompound.GetCompoundTag("Level");

                            AnvilConverterData anvilconverterdata = ChunkLoader.Load(nbttagcompound1);
                            NBTTagCompound     nbttagcompound2    = new NBTTagCompound();
                            NBTTagCompound     nbttagcompound3    = new NBTTagCompound();
                            nbttagcompound2.SetTag("Level", nbttagcompound3);

                            ChunkLoader.ConvertToAnvilFormat(anvilconverterdata, nbttagcompound3, par3WorldChunkManager);

                            Stream dataoutputstream = regionfile1.GetChunkDataOutputStream(i, j);
                            CompressedStreamTools.Write(nbttagcompound2, new BinaryWriter(dataoutputstream));
                            dataoutputstream.Close();
                        }
                    }

                    int k = (int)Math.Round((100D * (double)(par4 * 1024)) / (double)(par5 * 1024));
                    int l = (int)Math.Round((100D * (double)((i + 1) * 32 + par4 * 1024)) / (double)(par5 * 1024));

                    if (l > k)
                    {
                        par6IProgressUpdate.SetLoadingProgress(l);
                    }
                }

                regionfile.Close();
                regionfile1.Close();
            }
            catch (IOException ioexception)
            {
                Utilities.LogException(ioexception);
            }
        }