public static void Copy(RegionFile region, Bitmap selection, Color selectionColor) { BiomeCopy biomeData = new BiomeCopy(); for (int chunkX = 0; chunkX < 32; chunkX++) { for (int chunkZ = 0; chunkZ < 32; chunkZ++) { Chunk c = region.Chunks[chunkX, chunkZ]; if (c == null || c.Root == null) { continue; } byte[] biomes = (byte[])c.Root["Level"]["Biomes"]; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { if (selection.GetPixel(RegionUtil.OFFSETX + chunkX * 16 + x, RegionUtil.OFFSETY + chunkZ * 16 + z).ToArgb() == selectionColor.ToArgb()) { biomeData.Biomes[chunkX * 16 + x, chunkZ * 16 + z] = biomes[x + z * 16]; biomeData.Empty = false; if (biomeData.Left > chunkX * 16 + x) { biomeData.Left = chunkX * 16 + x; } if (biomeData.Right < chunkX * 16 + x) { biomeData.Right = chunkX * 16 + x; } if (biomeData.Top > chunkZ * 16 + z) { biomeData.Top = chunkZ * 16 + z; } if (biomeData.Bottom < chunkZ * 16 + z) { biomeData.Bottom = chunkZ * 16 + z; } } } } } } biomeData.Crop(); System.Windows.Forms.Clipboard.SetData("BiomeCopy", biomeData); }
public static void Copy(RegionFile region, Bitmap selection, Color selectionColor) { BiomeCopy biomeData = new BiomeCopy(); for (int chunkX = 0; chunkX < 32; chunkX++) { for (int chunkZ = 0; chunkZ < 32; chunkZ++) { Chunk c = region.Chunks[chunkX, chunkZ]; if (c == null || c.Root == null) continue; byte[] biomes = (byte[])c.Root["Level"]["Biomes"]; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { if (selection.GetPixel(RegionUtil.OFFSETX + chunkX * 16 + x, RegionUtil.OFFSETY + chunkZ * 16 + z).ToArgb() == selectionColor.ToArgb()) { biomeData.Biomes[chunkX * 16 + x, chunkZ * 16 + z] = biomes[x + z * 16]; biomeData.Empty = false; if (biomeData.Left > chunkX * 16 + x) biomeData.Left = chunkX * 16 + x; if (biomeData.Right < chunkX * 16 + x) biomeData.Right = chunkX * 16 + x; if (biomeData.Top > chunkZ * 16 + z) biomeData.Top = chunkZ * 16 + z; if (biomeData.Bottom < chunkZ * 16 + z) biomeData.Bottom = chunkZ * 16 + z; } } } } } biomeData.Crop(); System.Windows.Forms.Clipboard.SetData("BiomeCopy", biomeData); }