mapgen.lua: Add dirt/sand/gravel blob ores for mgv5/mgv7
[oweals/minetest_game.git] / mods / default / mapgen.lua
1 -- mods/default/mapgen.lua
2
3 --
4 -- Aliases for map generator outputs
5 --
6
7 minetest.register_alias("mapgen_stone", "default:stone")
8 minetest.register_alias("mapgen_tree", "default:tree")
9 minetest.register_alias("mapgen_leaves", "default:leaves")
10 minetest.register_alias("mapgen_jungletree", "default:jungletree")
11 minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves")
12 minetest.register_alias("mapgen_apple", "default:apple")
13 minetest.register_alias("mapgen_water_source", "default:water_source")
14 minetest.register_alias("mapgen_dirt", "default:dirt")
15 minetest.register_alias("mapgen_sand", "default:sand")
16 minetest.register_alias("mapgen_gravel", "default:gravel")
17 minetest.register_alias("mapgen_clay", "default:clay")
18 minetest.register_alias("mapgen_lava_source", "default:lava_source")
19 minetest.register_alias("mapgen_cobble", "default:cobble")
20 minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
21 minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
22 minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
23 minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal")
24 minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron")
25 minetest.register_alias("mapgen_mese", "default:mese")
26 minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
27 minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
28 minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
29
30 --
31 -- Ore generation
32 --
33
34 function default.register_ores()
35         minetest.register_ore({
36                 ore_type       = "scatter",
37                 ore            = "default:stone_with_coal",
38                 wherein        = "default:stone",
39                 clust_scarcity = 8*8*8,
40                 clust_num_ores = 8,
41                 clust_size     = 3,
42                 y_min          = -31000,
43                 y_max          = 64,
44         })
45
46         minetest.register_ore({
47                 ore_type       = "scatter",
48                 ore            = "default:stone_with_coal",
49                 wherein        = "default:stone",
50                 clust_scarcity = 24*24*24,
51                 clust_num_ores = 27,
52                 clust_size     = 6,
53                 y_min          = -31000,
54                 y_max          = 0,
55                 flags          = "absheight",
56         })
57
58         minetest.register_ore({
59                 ore_type       = "scatter",
60                 ore            = "default:stone_with_iron",
61                 wherein        = "default:stone",
62                 clust_scarcity = 12*12*12,
63                 clust_num_ores = 3,
64                 clust_size     = 2,
65                 y_min          = -15,
66                 y_max          = 2,
67         })
68
69         minetest.register_ore({
70                 ore_type       = "scatter",
71                 ore            = "default:stone_with_iron",
72                 wherein        = "default:stone",
73                 clust_scarcity = 9*9*9,
74                 clust_num_ores = 5,
75                 clust_size     = 3,
76                 y_min          = -63,
77                 y_max          = -16,
78         })
79
80         minetest.register_ore({
81                 ore_type       = "scatter",
82                 ore            = "default:stone_with_iron",
83                 wherein        = "default:stone",
84                 clust_scarcity = 7*7*7,
85                 clust_num_ores = 5,
86                 clust_size     = 3,
87                 y_min          = -31000,
88                 y_max          = -64,
89                 flags          = "absheight",
90         })
91
92         minetest.register_ore({
93                 ore_type       = "scatter",
94                 ore            = "default:stone_with_iron",
95                 wherein        = "default:stone",
96                 clust_scarcity = 24*24*24,
97                 clust_num_ores = 27,
98                 clust_size     = 6,
99                 y_min          = -31000,
100                 y_max          = -64,
101                 flags          = "absheight",
102         })
103
104         minetest.register_ore({
105                 ore_type       = "scatter",
106                 ore            = "default:stone_with_mese",
107                 wherein        = "default:stone",
108                 clust_scarcity = 18*18*18,
109                 clust_num_ores = 3,
110                 clust_size     = 2,
111                 y_min          = -255,
112                 y_max          = -64,
113                 flags          = "absheight",
114         })
115
116         minetest.register_ore({
117                 ore_type       = "scatter",
118                 ore            = "default:stone_with_mese",
119                 wherein        = "default:stone",
120                 clust_scarcity = 14*14*14,
121                 clust_num_ores = 5,
122                 clust_size     = 3,
123                 y_min          = -31000,
124                 y_max          = -256,
125                 flags          = "absheight",
126         })
127
128         minetest.register_ore({
129                 ore_type       = "scatter",
130                 ore            = "default:mese",
131                 wherein        = "default:stone",
132                 clust_scarcity = 36*36*36,
133                 clust_num_ores = 3,
134                 clust_size     = 2,
135                 y_min          = -31000,
136                 y_max          = -1024,
137                 flags          = "absheight",
138         })
139
140         minetest.register_ore({
141                 ore_type       = "scatter",
142                 ore            = "default:stone_with_gold",
143                 wherein        = "default:stone",
144                 clust_scarcity = 15*15*15,
145                 clust_num_ores = 3,
146                 clust_size     = 2,
147                 y_min          = -255,
148                 y_max          = -64,
149                 flags          = "absheight",
150         })
151
152         minetest.register_ore({
153                 ore_type       = "scatter",
154                 ore            = "default:stone_with_gold",
155                 wherein        = "default:stone",
156                 clust_scarcity = 13*13*13,
157                 clust_num_ores = 5,
158                 clust_size     = 3,
159                 y_min          = -31000,
160                 y_max          = -256,
161                 flags          = "absheight",
162         })
163
164         minetest.register_ore({
165                 ore_type       = "scatter",
166                 ore            = "default:stone_with_diamond",
167                 wherein        = "default:stone",
168                 clust_scarcity = 17*17*17,
169                 clust_num_ores = 4,
170                 clust_size     = 3,
171                 y_min          = -255,
172                 y_max          = -128,
173                 flags          = "absheight",
174         })
175
176         minetest.register_ore({
177                 ore_type       = "scatter",
178                 ore            = "default:stone_with_diamond",
179                 wherein        = "default:stone",
180                 clust_scarcity = 15*15*15,
181                 clust_num_ores = 4,
182                 clust_size     = 3,
183                 y_min          = -31000,
184                 y_max          = -256,
185                 flags          = "absheight",
186         })
187
188         minetest.register_ore({
189                 ore_type       = "scatter",
190                 ore            = "default:stone_with_copper",
191                 wherein        = "default:stone",
192                 clust_scarcity = 12*12*12,
193                 clust_num_ores = 4,
194                 clust_size     = 3,
195                 y_min          = -63,
196                 y_max          = -16,
197         })
198
199         minetest.register_ore({
200                 ore_type       = "scatter",
201                 ore            = "default:stone_with_copper",
202                 wherein        = "default:stone",
203                 clust_scarcity = 9*9*9,
204                 clust_num_ores = 5,
205                 clust_size     = 3,
206                 y_min          = -31000,
207                 y_max          = -64,
208                 flags          = "absheight",
209         })
210
211         minetest.register_ore({ 
212                 ore_type         = "blob",
213                 ore              = "default:clay",
214                 wherein          = {"default:sand"},
215                 clust_scarcity   = 24*24*24,
216                 clust_size       = 7,
217                 y_min            = -10,
218                 y_max            = 0,
219                 noise_threshhold = 0,
220                 noise_params     = {
221                         offset=0.35,
222                         scale=0.2,
223                         spread={x=5, y=5, z=5},
224                         seed=-316,
225                         octaves=1,
226                         persist=0.5
227                 },
228         })
229 end
230
231
232 function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max)
233         minetest.log('action', "WARNING: default.generate_ore is deprecated")
234
235         if maxp.y < height_min or minp.y > height_max then
236                 return
237         end
238         local y_min = math.max(minp.y, height_min)
239         local y_max = math.min(maxp.y, height_max)
240         if chunk_size >= y_max - y_min + 1 then
241                 return
242         end
243         local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
244         local pr = PseudoRandom(seed)
245         local num_chunks = math.floor(chunks_per_volume * volume)
246         local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
247         --print("generate_ore num_chunks: "..dump(num_chunks))
248         for i=1,num_chunks do
249                 local y0 = pr:next(y_min, y_max-chunk_size+1)
250                 if y0 >= height_min and y0 <= height_max then
251                         local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
252                         local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
253                         local p0 = {x=x0, y=y0, z=z0}
254                         for x1=0,chunk_size-1 do
255                         for y1=0,chunk_size-1 do
256                         for z1=0,chunk_size-1 do
257                                 if pr:next(1,inverse_chance) == 1 then
258                                         local x2 = x0+x1
259                                         local y2 = y0+y1
260                                         local z2 = z0+z1
261                                         local p2 = {x=x2, y=y2, z=z2}
262                                         if minetest.get_node(p2).name == wherein then
263                                                 minetest.set_node(p2, {name=name})
264                                         end
265                                 end
266                         end
267                         end
268                         end
269                 end
270         end
271         --print("generate_ore done")
272 end
273
274 --
275 -- Mgv6 papyrus, cactus, long grasses
276 --
277
278 function default.mgv6_ongen(minp, maxp, seed)
279
280         function default.make_papyrus(pos, size)
281                 for y=0,size-1 do
282                         local p = {x=pos.x, y=pos.y+y, z=pos.z}
283                         local nn = minetest.get_node(p).name
284                         if minetest.registered_nodes[nn] and
285                                 minetest.registered_nodes[nn].buildable_to then
286                                 minetest.set_node(p, {name="default:papyrus"})
287                         else
288                                 return
289                         end
290                 end
291         end
292
293         function default.make_cactus(pos, size)
294                 for y=0,size-1 do
295                         local p = {x=pos.x, y=pos.y+y, z=pos.z}
296                         local nn = minetest.get_node(p).name
297                         if minetest.registered_nodes[nn] and
298                                 minetest.registered_nodes[nn].buildable_to then
299                                 minetest.set_node(p, {name="default:cactus"})
300                         else
301                                 return
302                         end
303                 end
304         end
305
306         if maxp.y >= 2 and minp.y <= 0 then
307                 -- Generate papyrus
308                 local perlin1 = minetest.get_perlin(354, 3, 0.7, 100)
309                 -- Assume X and Z lengths are equal
310                 local divlen = 8
311                 local divs = (maxp.x-minp.x)/divlen+1;
312                 for divx=0,divs-1 do
313                 for divz=0,divs-1 do
314                         local x0 = minp.x + math.floor((divx+0)*divlen)
315                         local z0 = minp.z + math.floor((divz+0)*divlen)
316                         local x1 = minp.x + math.floor((divx+1)*divlen)
317                         local z1 = minp.z + math.floor((divz+1)*divlen)
318                         -- Determine papyrus amount from perlin noise
319                         local papyrus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20)
320                         -- Find random positions for papyrus based on this random
321                         local pr = PseudoRandom(seed+1)
322                         for i=0,papyrus_amount do
323                                 local x = pr:next(x0, x1)
324                                 local z = pr:next(z0, z1)
325                                 if minetest.get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and
326                                                 minetest.find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then
327                                         default.make_papyrus({x=x,y=2,z=z}, pr:next(2, 4))
328                                 end
329                         end
330                 end
331                 end
332                 -- Generate cactuses
333                 local perlin1 = minetest.get_perlin(230, 3, 0.6, 100)
334                 -- Assume X and Z lengths are equal
335                 local divlen = 16
336                 local divs = (maxp.x-minp.x)/divlen+1;
337                 for divx=0,divs-1 do
338                 for divz=0,divs-1 do
339                         local x0 = minp.x + math.floor((divx+0)*divlen)
340                         local z0 = minp.z + math.floor((divz+0)*divlen)
341                         local x1 = minp.x + math.floor((divx+1)*divlen)
342                         local z1 = minp.z + math.floor((divz+1)*divlen)
343                         -- Determine cactus amount from perlin noise
344                         local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3)
345                         -- Find random positions for cactus based on this random
346                         local pr = PseudoRandom(seed+1)
347                         for i=0,cactus_amount do
348                                 local x = pr:next(x0, x1)
349                                 local z = pr:next(z0, z1)
350                                 -- Find ground level (0...15)
351                                 local ground_y = nil
352                                 for y=30,0,-1 do
353                                         if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
354                                                 ground_y = y
355                                                 break
356                                         end
357                                 end
358                                 -- If desert sand, make cactus
359                                 if ground_y and minetest.get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then
360                                         default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4))
361                                 end
362                         end
363                 end
364                 end
365                 -- Generate grass
366                 local perlin1 = minetest.get_perlin(329, 3, 0.6, 100)
367                 -- Assume X and Z lengths are equal
368                 local divlen = 16
369                 local divs = (maxp.x-minp.x)/divlen+1;
370                 for divx=0,divs-1 do
371                 for divz=0,divs-1 do
372                         local x0 = minp.x + math.floor((divx+0)*divlen)
373                         local z0 = minp.z + math.floor((divz+0)*divlen)
374                         local x1 = minp.x + math.floor((divx+1)*divlen)
375                         local z1 = minp.z + math.floor((divz+1)*divlen)
376                         -- Determine grass amount from perlin noise
377                         local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9)
378                         -- Find random positions for grass based on this random
379                         local pr = PseudoRandom(seed+1)
380                         for i=0,grass_amount do
381                                 local x = pr:next(x0, x1)
382                                 local z = pr:next(z0, z1)
383                                 -- Find ground level (0...15)
384                                 local ground_y = nil
385                                 for y=30,0,-1 do
386                                         if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
387                                                 ground_y = y
388                                                 break
389                                         end
390                                 end
391
392                                 if ground_y then
393                                         local p = {x=x,y=ground_y+1,z=z}
394                                         local nn = minetest.get_node(p).name
395                                         -- Check if the node can be replaced
396                                         if minetest.registered_nodes[nn] and
397                                                 minetest.registered_nodes[nn].buildable_to then
398                                                 nn = minetest.get_node({x=x,y=ground_y,z=z}).name
399                                                 -- If desert sand, add dry shrub
400                                                 if nn == "default:desert_sand" then
401                                                         minetest.set_node(p,{name="default:dry_shrub"})
402
403                                                 -- If dirt with grass, add grass
404                                                 elseif nn == "default:dirt_with_grass" then
405                                                         minetest.set_node(p,{name="default:grass_"..pr:next(1, 5)})
406                                                 end
407                                         end
408                                 end
409
410                         end
411                 end
412                 end
413         end
414
415 end
416
417 --
418 -- Generate nyan cats in all mapgens
419 --
420
421 -- facedir: 0/1/2/3 (head node facedir value)
422 -- length: length of rainbow tail
423 function default.make_nyancat(pos, facedir, length)
424         local tailvec = {x=0, y=0, z=0}
425         if facedir == 0 then
426                 tailvec.z = 1
427         elseif facedir == 1 then
428                 tailvec.x = 1
429         elseif facedir == 2 then
430                 tailvec.z = -1
431         elseif facedir == 3 then
432                 tailvec.x = -1
433         else
434                 --print("default.make_nyancat(): Invalid facedir: "+dump(facedir))
435                 facedir = 0
436                 tailvec.z = 1
437         end
438         local p = {x=pos.x, y=pos.y, z=pos.z}
439         minetest.set_node(p, {name="default:nyancat", param2=facedir})
440         for i=1,length do
441                 p.x = p.x + tailvec.x
442                 p.z = p.z + tailvec.z
443                 minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir})
444         end
445 end
446
447
448 function default.generate_nyancats(minp, maxp, seed)
449         local height_min = -31000
450         local height_max = -32
451         if maxp.y < height_min or minp.y > height_max then
452                 return
453         end
454         local y_min = math.max(minp.y, height_min)
455         local y_max = math.min(maxp.y, height_max)
456         local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
457         local pr = PseudoRandom(seed + 9324342)
458         local max_num_nyancats = math.floor(volume / (16*16*16))
459         for i=1,max_num_nyancats do
460                 if pr:next(0, 1000) == 0 then
461                         local x0 = pr:next(minp.x, maxp.x)
462                         local y0 = pr:next(minp.y, maxp.y)
463                         local z0 = pr:next(minp.z, maxp.z)
464                         local p0 = {x=x0, y=y0, z=z0}
465                         default.make_nyancat(p0, pr:next(0,3), pr:next(3,15))
466                 end
467         end
468 end
469
470
471 minetest.register_on_generated(default.generate_nyancats)
472
473 --
474 -- Register biomes
475 --
476
477 function default.register_biomes()
478         minetest.clear_registered_biomes()
479
480         minetest.register_biome({
481                 name = "grassland",
482                 node_top = "default:dirt_with_grass",
483                 node_shore_top = "default:sand",
484                 depth_top = 1,
485                 node_filler = "default:dirt",
486                 node_shore_filler = "default:sand",
487                 depth_filler = 2,
488                 height_shore = 3,
489                 node_underwater = "default:sand",
490                 --node_stone = "",
491                 --node_water_top = "",
492                 --depth_water_top = ,
493                 --node_water = "",
494                 --node_dust = "",
495                 y_min = -31000,
496                 y_max = 31000,
497                 heat_point = 50,
498                 humidity_point = 50,
499         })
500
501         --
502         -- Register decorations
503         --
504
505         -- Flowers
506
507         minetest.register_decoration({
508                 deco_type = "simple",
509                 place_on = {"default:dirt_with_grass"},
510                 sidelen = 16,
511                 noise_params = {
512                         offset = -0.02,
513                         scale = 0.03,
514                         spread = {x=100, y=100, z=100},
515                         seed = 436,
516                         octaves = 3,
517                         persist = 0.6
518                 },
519                 biomes = {"grassland"},
520                 y_min = -31000,
521                 y_max = 31000,
522                 decoration = "flowers:rose",
523         })
524
525         minetest.register_decoration({
526                 deco_type = "simple",
527                 place_on = {"default:dirt_with_grass"},
528                 sidelen = 16,
529                 noise_params = {
530                         offset = -0.02,
531                         scale = 0.03,
532                         spread = {x=100, y=100, z=100},
533                         seed = 19822,
534                         octaves = 3,
535                         persist = 0.6
536                 },
537                 biomes = {"grassland"},
538                 y_min = -31000,
539                 y_max = 31000,
540                 decoration = "flowers:tulip",
541         })
542
543         minetest.register_decoration({
544                 deco_type = "simple",
545                 place_on = {"default:dirt_with_grass"},
546                 sidelen = 16,
547                 noise_params = {
548                         offset = -0.02,
549                         scale = 0.03,
550                         spread = {x=100, y=100, z=100},
551                         seed = 1220999,
552                         octaves = 3,
553                         persist = 0.6
554                 },
555                 biomes = {"grassland"},
556                 y_min = -31000,
557                 y_max = 31000,
558                 decoration = "flowers:dandelion_yellow",
559         })
560
561         minetest.register_decoration({
562                 deco_type = "simple",
563                 place_on = {"default:dirt_with_grass"},
564                 sidelen = 16,
565                 noise_params = {
566                         offset = -0.02,
567                         scale = 0.03,
568                         spread = {x=100, y=100, z=100},
569                         seed = 36662,
570                         octaves = 3,
571                         persist = 0.6
572                 },
573                 biomes = {"grassland"},
574                 y_min = -31000,
575                 y_max = 31000,
576                 decoration = "flowers:geranium",
577         })
578
579         minetest.register_decoration({
580                 deco_type = "simple",
581                 place_on = {"default:dirt_with_grass"},
582                 sidelen = 16,
583                 noise_params = {
584                         offset = -0.02,
585                         scale = 0.03,
586                         spread = {x=100, y=100, z=100},
587                         seed = 1133,
588                         octaves = 3,
589                         persist = 0.6
590                 },
591                 biomes = {"grassland"},
592                 y_min = -31000,
593                 y_max = 31000,
594                 decoration = "flowers:viola",
595         })
596
597         minetest.register_decoration({
598                 deco_type = "simple",
599                 place_on = {"default:dirt_with_grass"},
600                 sidelen = 16,
601                 noise_params = {
602                         offset = -0.02,
603                         scale = 0.03,
604                         spread = {x=100, y=100, z=100},
605                         seed = 73133,
606                         octaves = 3,
607                         persist = 0.6
608                 },
609                 biomes = {"grassland"},
610                 y_min = -31000,
611                 y_max = 31000,
612                 decoration = "flowers:dandelion_white",
613         })
614
615         -- Grasses
616
617         minetest.register_decoration({
618                 deco_type = "simple",
619                 place_on = {"default:dirt_with_grass"},
620                 sidelen = 16,
621                 noise_params = {
622                         offset = 0.04,
623                         scale = 0.08,
624                         spread = {x=100, y=100, z=100},
625                         seed = 66440,
626                         octaves = 3,
627                         persist = 0.6
628                 },
629                 biomes = {"grassland"},
630                 y_min = -31000,
631                 y_max = 31000,
632                 decoration = "default:grass_1",
633         })
634
635         minetest.register_decoration({
636                 deco_type = "simple",
637                 place_on = {"default:dirt_with_grass"},
638                 sidelen = 16,
639                 noise_params = {
640                         offset = 0.02,
641                         scale = 0.08,
642                         spread = {x=100, y=100, z=100},
643                         seed = 66440,
644                         octaves = 3,
645                         persist = 0.6
646                 },
647                 biomes = {"grassland"},
648                 y_min = -31000,
649                 y_max = 31000,
650                 decoration = "default:grass_2",
651         })
652
653         minetest.register_decoration({
654                 deco_type = "simple",
655                 place_on = {"default:dirt_with_grass"},
656                 sidelen = 16,
657                 noise_params = {
658                         offset = 0,
659                         scale = 0.08,
660                         spread = {x=100, y=100, z=100},
661                         seed = 66440,
662                         octaves = 3,
663                         persist = 0.6
664                 },
665                 biomes = {"grassland"},
666                 y_min = -31000,
667                 y_max = 31000,
668                 decoration = "default:grass_3",
669         })
670
671         minetest.register_decoration({
672                 deco_type = "simple",
673                 place_on = {"default:dirt_with_grass"},
674                 sidelen = 16,
675                 noise_params = {
676                         offset = -0.02,
677                         scale = 0.08,
678                         spread = {x=100, y=100, z=100},
679                         seed = 66440,
680                         octaves = 3,
681                         persist = 0.6
682                 },
683                 biomes = {"grassland"},
684                 y_min = -31000,
685                 y_max = 31000,
686                 decoration = "default:grass_4",
687         })
688
689         minetest.register_decoration({
690                 deco_type = "simple",
691                 place_on = {"default:dirt_with_grass"},
692                 sidelen = 16,
693                 noise_params = {
694                         offset = -0.04,
695                         scale = 0.08,
696                         spread = {x=100, y=100, z=100},
697                         seed = 66440,
698                         octaves = 3,
699                         persist = 0.6
700                 },
701                 biomes = {"grassland"},
702                 y_min = -31000,
703                 y_max = 31000,
704                 decoration = "default:grass_5",
705         })
706 end
707
708 --
709 -- Register blob ore
710 --
711
712 function default.register_blobs()
713         minetest.register_ore({ 
714                 ore_type         = "blob",
715                 ore              = "default:sand",
716                 wherein          = {"default:stone"},
717                 clust_scarcity   = 24*24*24,
718                 clust_size       = 7,
719                 y_min            = -63,
720                 y_max            = 4,
721                 noise_threshhold = 0,
722                 noise_params     = {
723                         offset=0.35,
724                         scale=0.2,
725                         spread={x=5, y=5, z=5},
726                         seed=2316,
727                         octaves=1,
728                         persist=0.5
729                 },
730         })
731
732         minetest.register_ore({
733                 ore_type         = "blob",
734                 ore              = "default:dirt",
735                 wherein          = {"default:stone"},
736                 clust_scarcity   = 24*24*24,
737                 clust_size       = 7,
738                 y_min            = -63,
739                 y_max            = 31000,
740                 noise_threshhold = 0,
741                 noise_params     = {
742                         offset=0.35,
743                         scale=0.2,
744                         spread={x=5, y=5, z=5},
745                         seed=17676,
746                         octaves=1,
747                         persist=0.5
748                 },
749         })
750
751         minetest.register_ore({
752                 ore_type         = "blob",
753                 ore              = "default:gravel",
754                 wherein          = {"default:stone"},
755                 clust_scarcity   = 24*24*24,
756                 clust_size       = 7,
757                 y_min            = -31000,
758                 y_max            = 31000,
759                 noise_threshhold = 0,
760                 noise_params     = {
761                         offset=0.35,
762                         scale=0.2,
763                         spread={x=5, y=5, z=5},
764                         seed=766,
765                         octaves=1,
766                         persist=0.5
767                 },
768         })
769 end
770
771 --
772 -- Detect mapgen and select suitable biome code
773 --
774
775 local mg_params = minetest.get_mapgen_params()
776 if mg_params.mgname == "v5" then
777         default.register_biomes()
778         default.register_blobs()
779         default.register_ores()
780 elseif mg_params.mgname == "v6" then
781         minetest.register_on_generated(default.mgv6_ongen)
782         default.register_ores()
783 elseif mg_params.mgname == "v7" then
784         default.register_biomes()
785         default.register_blobs()
786         default.register_ores()
787 end
788