local S = minetest.get_translator("map_barriers")
undiggable_node_api.register_barrier("map_barriers:bedrock",
	{
		description = S("Bedrock"),
		tiles = {"basic_ground_nodes_stone.png"},
		sounds = generic_media.node_sound_stone_defaults(),
	})




--generating bedrock layer
local c_bedrock = minetest.get_content_id("map_barriers:bedrock")
local lvm_buffer = {}
local function on_generated(minp, maxp, blockseed)

	if not (-20 <= maxp.y and -20 >= minp.y)
	then
		return
	end

	local lvm, emin, emax = minetest.get_mapgen_object("voxelmanip")
	--passing a buffer increases performance by lowering need to
	--allocate memory
	local data = lvm:get_data(lvm_buffer)
	local a = VoxelArea:new{MinEdge = emin, MaxEdge = emax}

	for z = emin.z, emax.z
	do
		for x = emin.x, emax.x
		do
			local index = a:index(x, -20, z)
			data[index] = c_bedrock
		end
	end
	lvm:set_data(data)
	lvm:calc_lighting()
	lvm:write_to_map(data)
end
minetest.register_on_generated(on_generated)
