示例#1
0
        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);
        }
示例#2
0
 ///<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;
     }
 }
示例#3
0
        ///<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);
                //}
            }
        }
示例#4
0
 ///<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);
 }
示例#5
0
 public BiomeGenerator(BiomeID biome)
 {
     biomeID = biome;
 }