air = material( 0); stone = material( 1); dirt = material( 3); bedrock = material( 7); water = material( 8); sand = material(12); glowstone = material(89); birch = material(17,2); max(a,b) = if(a > b, a, b); min(a,b) = if(a < b, a, b); # list(...) creates a list of things, and # a list of layers can be supplied as an argument to layered-terrain. # It will be treated the same as all of the contained layers. flooded-cave-layer( floor, ceiling ) = list( layer( air , (x,z) -> max(63, floor(x,z)), ceiling ), layer( water, floor, (x,z) -> min(63, ceiling(x,z)) ) ); cave-ceiling(x,z) = 64 + 48 * simplex(z / 96, x / 192, 0); ground-height(x,z) = 96 + simplex(x / 150, 0, z / 150) * 150; layered-terrain( layer( stone, 0, ground-height ), layer( (x,y,z) -> if( simplex(x * 3.1, y * 3.1, z * 3.1) > 0, birch, sand ), ground-height, (x,z) -> ground-height(x,z) + 1 ), flooded-cave-layer( (x,z) -> 64 + 48 * simplex(x / 64, 0, z / 64), cave-ceiling ), layer( glowstone, cave-ceiling, (x,z) -> cave-ceiling(x,z) + simplex(x,0,z) * 3 ), layer( bedrock, 0, 1 ), grassify, flag-populated )