OpenMinecraft.InfdevHandler.Load C# (CSharp) Method

Load() public method

public Load ( string filename ) : void
filename string
return void
        public override void Load(string filename)
		{
			try
			{
				mChunks.Clear();
				//CurrentBlock = new Vector3i(0, 0, 0);
				Filename = filename;
				mFolder = Path.GetDirectoryName(filename);
				mRoot = new NbtFile(filename);
				mRoot.LoadFile();
			}
			catch (Exception e)
			{
                if(_DEBUG) Console.WriteLine(e);
				System.Windows.Forms.DialogResult dr = System.Windows.Forms.MessageBox.Show("Your level.dat is broken. Copying over level.dat_old...","ERROR",System.Windows.Forms.MessageBoxButtons.OKCancel);
				if (dr == System.Windows.Forms.DialogResult.OK)
				{
					File.Copy(Path.ChangeExtension(filename, "dat_old"), filename, true);
					Load(filename);
				}
				else return;
            }
            if (Cache == null)
            {
                Cache = new MapMetadata(this, mFolder);
                Cache.UpdateCache();
            }
			LoadChunk(0, 0);
		}

Same methods

InfdevHandler::Load ( ) : void

Usage Example

Ejemplo n.º 1
0
        public void TEST001_ReadMap()
        {
            if (Directory.Exists("001"))
                Directory.Delete("001", true);
            Directory.CreateDirectory("001"); // Copies map here.
            Utils.CopyRecursive("001_PRISTINE", "001");

            InfdevHandler mh = new InfdevHandler();
            mh.Load("001/level.dat");
            mh.SetDimension(0);

            //Loading 3 entities in chunk 14,8 (C:\Users\Rob\AppData\Roaming\.minecraft\saves\World5\e\8\c.e.8.dat):
            Chunk a = mh.GetChunk(14, 8);
            Assert.AreEqual(3, a.Entities.Count);

            Directory.Delete("001", true);
        }
All Usage Examples Of OpenMinecraft.InfdevHandler::Load