--- generate container with loot

minetest.register_node("hwmod:container", {
  description = "spawn loot container",
  tiles = {"hwmod_node.png"},
  groups = {cracky = 1},
  on_construct = function(pos)
    local meta = minetest.get_meta(pos)
    meta:set_string("formspec", "size[8,9]" ..
            "list[current_name;main;0,0;8,4;]" ..
            "list[current_player;main;0,5;8,4;]")
    meta:set_string("infotext", "Your Node")
    local inv = meta:get_inventory()
    inv:set_size("main", 1 * 4)
    local stack = ItemStack("default:stone 1")
    inv:add_item("main", stack)
    local stack = ItemStack("default:cobble 1")
    inv:add_item("main", stack)
    local stack = ItemStack("default:clay 1")
    inv:add_item("main", stack)
  end,
})

Изменить пасту