7 minetest.register_biome({
13 node_riverbed = "air",
18 node_dungeon_alt = "air",
19 node_dungeon_stair = "air",
20 node_cave_liquid = "air",
25 humidity_point = -100,
28 --this is from https://github.com/paramat/lvm_example/blob/master/init.lua
31 -- Set the 3D noise parameters for the terrain.
35 spread = {x = 200, y = 100, z = 200},
36 seed = tonumber(minetest.get_mapgen_setting("seed")) or math.random(0,999999999),
44 -- Set singlenode mapgen (air nodes only).
45 -- Disable the engine lighting calculation since that will be done for a
46 -- mapchunk of air nodes and will be incorrect after we place nodes.
47 --minetest.set_mapgen_params({mgname = "singlenode", flags = "nolight"})
48 -- Get the content IDs for the nodes used.
50 local nobj_terrain = nil
55 local permapdims3d = {}
56 local nobj_terrain = {}
62 local density_noise = {}
64 local nvals_terrain = {}
67 local content_id = minetest.get_name_from_content_id
68 local get_map = minetest.get_perlin_map
69 local get_mapgen_object = minetest.get_mapgen_object
71 local c_dirt = minetest.get_content_id("aether:dirt")
72 local c_stone = minetest.get_content_id("aether:stone")
73 local c_air = minetest.get_content_id("air")
74 local c_grass = minetest.get_content_id("aether:grass")
75 -- On generated function.
77 -- 'minp' and 'maxp' are the minimum and maximum positions of the mapchunk that
78 -- define the 3D volume.
79 minetest.register_on_generated(function(minp, maxp, seed)
80 --aether starts at 21000
81 if minp.y < 21000 then
85 -- Start time of mapchunk generation.
86 --local t0 = minetest.get_us_time()/1000000
88 sidelen = maxp.x - minp.x + 1
90 permapdims3d = {x = sidelen, y = sidelen, z = sidelen}
92 nobj_terrain = get_map(np_terrain, permapdims3d)
94 nobj_terrain:get_3d_map_flat(minp, nvals_terrain)
98 vm, emin, emax = get_mapgen_object("voxelmanip")
100 area = VoxelArea:new{MinEdge = emin, MaxEdge = emax}
104 for z = minp.z, maxp.z do
105 for y = minp.y, maxp.y do
107 vi = area:index(minp.x, y, z)
108 for x = minp.x, maxp.x do
110 density_noise = nvals_terrain[ni]
112 if density_noise > 0.1 then
116 n_pos = area:index(x,y-1,z)
117 node2 = content_id(data[n_pos])
118 if node2 == "aether:dirt" then
119 data[n_pos] = c_grass
133 vm:set_lighting({day=15,night=0}, minp, maxp)
138 -- Liquid nodes were placed so set them flowing.
139 --vm:update_liquids()
141 -- Print generation time of this mapchunk.
142 --local chugent = math.ceil((minetest.get_us_time()/1000000- t0) * 1000)
143 --print ("[lvm_example] Mapchunk generation time " .. chugent .. " ms")