void PlantGrass() {
for( int x = 0; x < genParams.MapWidth; x++ ) {
for( int y = 0; y < genParams.MapLength; y++ ) {
bool blockAboveIsAir = true;
for( int z = genParams.MapHeight - 1; z > 0; z-- ) {
bool thisBlockIsAir = (map.GetBlock( x, y, z ) == Block.Air);
if( blockAboveIsAir && !thisBlockIsAir ) {
map.SetBlock( x, y, z, Block.Grass );
}
blockAboveIsAir = thisBlockIsAir;
}
}
}
/*
PerlinNoise pn = new PerlinNoise( rand, 3 );
for( int x = 1; x < genParams.MapWidth-1; x++ ) {
for( int y = 1; y < genParams.MapLength-1; y++ ) {
for( int z = 1; z < genParams.MapHeight - 1; z++ ) {
if( map.GetBlock( x, y, z ) == Block.Grass ) {
double slope = FindSlope( x, y, z );
if( slope < 2 && pn.GetNoise( x/5d, y/5d ) > .6 ) {
map.SetBlock( x, y, z, Block.Sand );
}
}
}
}
}*/
}