External Publication
Visit Post

Modding Discussion • Re: pass a heightmap to mapgen.

Luanti Forums - Index page [Unofficial] April 24, 2026
Source

I figured to use a single-node world, do my own terrain generation, and then call core.generate_decorations See below an example:

Code:

core.register_on_generated(function(minp, maxp, seed) local vm, emin, emax = core.get_mapgen_object("voxelmanip") local area = VoxelArea:new({MinEdge = emin, MaxEdge = emax}) local data = vm:get_data() for z = minp.z, maxp.z do for x = minp.x, maxp.x do local h = get_height(x, z) for y = minp.y, maxp.y do local vi = area:index(x,y,z) data[vi] = stone if y > h then data[vi] = air elseif y == h then data[vi] = grass elseif y > h - 3 then data[vi] = dirt end end end end end vm:set_data(data) -- generate decoration and ores -- core.generate_ores(vm, minp, maxp) core.generate_decorations(vm, minp, maxp) -- Calculate lighting, write data, and update liquidsvm:calc_lighting()vm:write_to_map()vm:update_liquids()end)

Statistics: Posted by Ghurir — Fri Apr 24, 2026 23:38


Discussion in the ATmosphere

Loading comments...