示例#1
0
        public override void load(string name)
        {
            DirectoryInfo directoryInfo = new FileInfo(name).Directory;

            if (directoryInfo != null)
            {
                directoryInfo.Create();
            }
            StreamReader stream;

            try { stream = new StreamReader(name); } catch { throw new Exception("Could not read file : " + name); }


            this.mIslandSize = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));

            while (stream.BaseStream.Position != stream.BaseStream.Length)
            {
                Vector3 pos = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));
                Chunk   c   = new VanillaChunk(new Vector3(16, 16, 16), pos, this);
                this.mChunkList.Add(pos, c);
                for (int x = 0; x < 16; x++)
                {
                    for (int y = 0; y < 16; y++)
                    {
                        for (int z = 0; z < 16; z++)
                        {
                            c.setBlock(x, y, z, Convert.ToByte(stream.ReadLine()));
                        }
                    }
                }
            }

            stream.Close();
        }
示例#2
0
        public override void load()
        {
            var blockfileName = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SkyLands\\" +
                                this.mWorld.getName() + "-Island-" + this.mBiome.getId() + ".sav";
            DirectoryInfo directoryInfo = new FileInfo(blockfileName).Directory;

            if (directoryInfo != null)
            {
                directoryInfo.Create();
            }
            StreamReader stream;

            try { stream = new StreamReader(blockfileName); }
            catch { throw new Exception("Could not read file : " + blockfileName); }


            this.mIslandSize = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));

            while (stream.BaseStream.Position != stream.BaseStream.Length)
            {
                Vector3 pos = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));
                Chunk   c   = new VanillaChunk(new Vector3(16, 16, 16), pos, this);
                this.mChunkList.Add(pos, c);
                for (int x = 0; x < 16; x++)
                {
                    for (int y = 0; y < 16; y++)
                    {
                        for (int z = 0; z < 16; z++)
                        {
                            c.setBlock(x, y, z, Convert.ToByte(stream.ReadLine()));
                        }
                    }
                }
            }

            stream.Close();
        }
示例#3
0
        public override void load(string name)
        {
            DirectoryInfo directoryInfo = new FileInfo(name).Directory;
            if(directoryInfo != null) {
                directoryInfo.Create();
            }
            StreamReader stream;

            try { stream = new StreamReader(name); } catch { throw new Exception("Could not read file : " + name); }

            this.mIslandSize = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));

            while(stream.BaseStream.Position != stream.BaseStream.Length) {
                Vector3 pos = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));
                Chunk c = new VanillaChunk(new Vector3(16, 16, 16), pos, this);
                this.mChunkList.Add(pos, c);
                for(int x = 0; x < 16; x++) { for(int y = 0; y < 16; y++) { for(int z = 0; z < 16; z++) { c.setBlock(x, y, z, Convert.ToByte(stream.ReadLine())); } } }
            }

            stream.Close();
        }
示例#4
0
        public override void load()
        {
            var blockfileName = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SkyLands\\" +
            this.mWorld.getName() + "-Island-" + this.mBiome.getId() + ".sav";
            DirectoryInfo directoryInfo = new FileInfo(blockfileName).Directory;
            if(directoryInfo != null) {
                directoryInfo.Create();
            }
            StreamReader stream;

            try { stream = new StreamReader(blockfileName); }
            catch { throw new Exception("Could not read file : " + blockfileName); }

            this.mIslandSize = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));

            while(stream.BaseStream.Position != stream.BaseStream.Length) {
                Vector3 pos = new Vector3(Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()), Convert.ToInt32(stream.ReadLine()));
                Chunk c = new VanillaChunk(new Vector3(16, 16, 16), pos, this);
                this.mChunkList.Add(pos, c);
                for(int x = 0; x < 16; x++) { for(int y = 0; y < 16; y++) { for(int z = 0; z < 16; z++) { c.setBlock(x, y, z, Convert.ToByte(stream.ReadLine())); } } }
            }

            stream.Close();
        }