private static void Replace(RegionFile region, Bitmap selection, Color selectionColor, byte search, BiomeUtil replace) { foreach (Chunk c in region.Chunks) { if (c.Root == null) continue; Coord chunkOffset = new Coord(region.Coords); chunkOffset.RegiontoChunk(); chunkOffset = new Coord(c.Coords.X - chunkOffset.X, c.Coords.Z - chunkOffset.Z); chunkOffset.ChunktoAbsolute(); Coord chunkAbs = new Coord(c.Coords); chunkAbs.ChunktoAbsolute(); byte[] biomes = (byte[])c.Root["Level"]["Biomes"]; for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++) { if (selection == null || (selection.GetPixel(OFFSETX + chunkOffset.X + x, OFFSETY + chunkOffset.Z + z).ToArgb() == selectionColor.ToArgb())) { if (biomes[x + z * 16] == search) { biomes[x + z * 16] = (byte)replace.GetBiome(chunkAbs.X + x, chunkAbs.Z + z); } } } } } }
private static void GetBiome(Object input, long seed, out byte? biomeId, out BiomeUtil biomeGen) { biomeId = null; biomeGen = null; if (input is BiomeType) { biomeId = ((BiomeType)input).ID; } else if (input is String) { switch ((String)input) { case "Minecraft Beta 1.3_01": biomeGen = new Minecraft.BiomeGen.B13.MobSpawnerBase(seed); break; case "Minecraft Beta 1.7.3": biomeGen = new Minecraft.BiomeGen.B17.BiomeGenBase(seed); break; case "Minecraft Beta 1.8.1": biomeGen = new Minecraft.BiomeGen.B18.WorldChunkManager(seed); break; case "Minecraft 1.0.0": biomeGen = new Minecraft.BiomeGen.F10.WorldChunkManager(seed); break; case "Minecraft 1.1.0": biomeGen = new Minecraft.BiomeGen.F11.WorldChunkManager(seed); break; case "Minecraft 1.2.5": biomeGen = new Minecraft.BiomeGen.F12.WorldChunkManager(seed); break; case "Minecraft 1.3.2": Minecraft.BiomeGen.F13.WorldChunkManager.LargeBiomes = false; biomeGen = new Minecraft.BiomeGen.F13.WorldChunkManager(seed); break; case "MC 1.3.2 (Large biomes)": Minecraft.BiomeGen.F13.WorldChunkManager.LargeBiomes = true; biomeGen = new Minecraft.BiomeGen.F13.WorldChunkManager(seed); break; case "Minecraft 1.4.7": Minecraft.BiomeGen.F14.WorldChunkManager.LargeBiomes = false; biomeGen = new Minecraft.BiomeGen.F14.WorldChunkManager(seed); break; case "MC 1.4.7 (Large biomes)": Minecraft.BiomeGen.F14.WorldChunkManager.LargeBiomes = true; biomeGen = new Minecraft.BiomeGen.F14.WorldChunkManager(seed); break; case "Minecraft 1.5.2": Minecraft.BiomeGen.F15.WorldChunkManager.LargeBiomes = false; biomeGen = new Minecraft.BiomeGen.F15.WorldChunkManager(seed); break; case "MC 1.5.2 (Large biomes)": Minecraft.BiomeGen.F15.WorldChunkManager.LargeBiomes = true; biomeGen = new Minecraft.BiomeGen.F15.WorldChunkManager(seed); break; default: throw new Exception("Unrecognized Minecraft version: " + (String)input); } } }