예제 #1
0
        int GetHeight(int x, int z)
        {
            var NoiseValue = FinalNoise.Value2D(x, z) + GroundLevel;

            if (NoiseValue < 0)
            {
                NoiseValue = GroundLevel;
            }
            if (NoiseValue > Chunk.Height)
            {
                NoiseValue = Chunk.Height - 1;
            }
            return((int)NoiseValue);
        }
예제 #2
0
        int GetHeight(int x, int z)
        {
            var    value    = FinalNoise.Value2D(x, z) + GroundLevel;
            var    coords   = new Coordinates2D(x, z);
            double distance = IsSpawnCoordinate(x, z) ? coords.Distance : 1000;

            if (distance < 1000) // Avoids deep water within 1km sq of spawn
            {
                value += (1 - distance / 1000f) * 18;
            }
            if (value < 0)
            {
                value = GroundLevel;
            }
            if (value > Chunk.Height)
            {
                value = Chunk.Height - 1;
            }
            return((int)value);
        }