Exemple #1
0
        public override void ProcessRegion(World world, MCUtils.Region reg, int rx, int rz, int pass)
        {
            ConsoleOutput.WriteLine($"Starting merge for region [{rx},{rz}] ...");
            int scale = chunkMode ? 32 : 512;

            bool[,] fraction;
            lock (mask)
            {
                fraction = GetSubMask((rx - upperLeftCornerRegionX) * scale, (rz - upperLeftCornerRegionZ) * scale, scale, scale);
            }
            string otherRegionName = otherRegionPrefix + $"r.{rx}.{rz}.mca";
            var    filename        = Path.Combine(otherRegionFolder, otherRegionName);

            if (File.Exists(filename))
            {
                var otherRegion  = RegionImporter.OpenRegionFile(filename);
                var merger       = new RegionMerger(otherRegion, reg, fraction);
                var mergedRegion = merger.Merge();
                for (int x = 0; x < 32; x++)
                {
                    for (int z = 0; z < 32; z++)
                    {
                        reg.chunks[x, z] = mergedRegion.chunks[x, z];
                    }
                }
            }
            else
            {
                ConsoleOutput.WriteWarning($"Merge region '{otherRegionName}' was not found, no merging was done");
            }
        }