private BiomeID GetPredominantBiomeIn4x4Area(int x, int z) { Dictionary <BiomeID, byte> occurences = new Dictionary <BiomeID, byte>(); for (int x1 = 0; x1 < 4; x1++) { for (int z1 = 0; z1 < 4; z1++) { var b = biomes[x * 4 + x1, z * 4 + z1]; if (!occurences.ContainsKey(b)) { occurences.Add(b, 0); } occurences[b]++; } } BiomeID predominantBiome = 0; int predominantCells = 0; foreach (var k in occurences.Keys) { if (occurences[k] > predominantCells) { predominantCells = occurences[k]; predominantBiome = k; } } return(predominantBiome); }
///<summary>Sets the biome at the given chunk coordinate</summary> public void SetBiomeAt(int x, int z, BiomeID biome) { lock (lockObj) { biomes[x, z] = biome; } }
///<summary>Sets the biome at the given location.</summary> public void SetBiome(int x, int z, BiomeID biome) { var chunk = GetChunk(x, z, false); if (chunk != null) { //for(int y = 0; y < 256; y++) //{ chunk.SetBiomeAt(x % 16, z % 16, biome); //} } }
///<summary>Sets the biome at the given location.</summary> public void SetBiome(int x, int z, BiomeID biome) { TryGetRegion(x, z)?.SetBiome(x % 512, z % 512, biome); }
public BiomeGenerator(BiomeID biome) { biomeID = biome; }