diff --git a/init.lua b/init.lua index 2294b09..e60370b 100644 --- a/init.lua +++ b/init.lua @@ -625,14 +625,17 @@ function internal.generate_caves(data, minp, maxp) internal.humidity_noise_params(), bminp, bmaxp ) + local air = minetest.get_content_id("air") + -- Place blocks where necessary internal.iter_3d_area(bminp, bmaxp, function (i, pos) + local function place(name) - if type(name) == "string" then - vmanip:set_index( - vmanip:pos_to_index(pos), - minetest.get_content_id(name) - ) + local vi = vmanip:pos_to_index(pos) + + if vmanip:get_index(vi) == air then + elseif type(name) == "string" then + vmanip:set_index(vi, minetest.get_content_id(name)) elseif type(name) == "nil" then else error("Inserted invalid type " .. type(name) .. " into voxelmanip array")