void Soil() {
Random soilRand = new Random( random.Next() );
PerlinNoise soilNoise1 = new PerlinNoise( soilRand, 8 );
for( int x = 0; x < genParams.MapWidth; x++ ) {
for( int y = 0; y < genParams.MapLength; y++ ) {
int i7 = (int)(soilNoise1.GetNoise( x, y )/24) - 4;
int i19 = heightmap[(x + y*genParams.MapWidth)] + waterLevel;
int i21 = i19 + i7;
heightmap[(x + y*genParams.MapWidth)] = Math.Max( i19, i21 );
if( heightmap[(x + y*genParams.MapWidth)] > genParams.MapHeight - 2 )
heightmap[(x + y*genParams.MapWidth)] = (genParams.MapHeight - 2);
if( heightmap[(x + y*genParams.MapWidth)] < 1 )
heightmap[(x + y*genParams.MapWidth)] = 1;
for( int z = 0; z < genParams.MapHeight; z++ ) {
Block block = Block.Air;
if( z <= i19 )
block = Block.Dirt;
if( z <= i21 )
block = Block.Stone;
if( z == 0 )
block = Block.Lava;
int index = (z*genParams.MapLength + y)*genParams.MapWidth + x;
blocks[index] = (byte)block;
}
}
}
}