Beispiel #1
0
 public RegionRecord(WorldMerger merger, int rx, int rz)
 {
     loc            = new RegionLocation(rx, rz);
     filename       = $"r.{rx}.{rz}.mca";
     existsInWorld1 = File.Exists(Path.Combine(merger.world1Path, filename));
     existsInWorld2 = File.Exists(Path.Combine(merger.world2Path, filename));
 }
Beispiel #2
0
        public static void Main(string[] args)
        {
            Console.ResetColor();
            Console.Clear();
            WriteLine("--------------");
            WriteLine("MinecraftUtils");
            WriteLine("--------------");
            string fname = null;

            if (args.Length > 0)
            {
                if (File.Exists(args[0]))
                {
                    var v = new NBTViewer(args[0]);
                    v.Run();
                }
            }
            else
            {
                Console.WriteLine("File '" + fname + "' does not exist!");
            }
            string input = "";

            while (input != "exit")
            {
                WriteLine("Chose an operation to perform:");
                WriteLine("- mergeregions       Merges region files based on an input map");
                WriteLine("- mergeworlds        Merges worlds based on an input map");
                WriteLine("- randomblocks       Makes a region out of random blocks");
                WriteLine("- view               Shows the contents of an NBT file or region");
                WriteLine("- readchunk          Loads chunk data at a specific byte offset in a region file");
                input = GetInput();
                if (input.StartsWith("mergeregions"))
                {
                    var m = new RegionMergerConsoleTool();
                    m.Run();
                }
                if (input.StartsWith("mergeworlds"))
                {
                    var m = new WorldMerger();
                    m.Run();
                }
                if (input.StartsWith("randomblocks"))
                {
                    var g = new RandomBlockRegionGen();
                    g.Run();
                }
                if (input.StartsWith("view "))
                {
                    var v = new NBTViewer(input.Substring(5).Replace("\"", ""));
                    v.Run();
                }
                if (input.StartsWith("readchunk "))
                {
                    WriteLine("enter index: ");
                    int index = int.Parse(Console.ReadLine());
                    var v     = new NBTViewer(RegionLoader.LoadChunkDataAtIndex(input.Substring(10).Replace("\"", ""), index));
                    v.Run();
                }
            }
        }