-- Right-clicking this node with a bare hand and no diamonds in the inventory will not give you anything
-- Right-clicking with any item or diamonds in your inventory, however, gives you three diamonds as expected.
minetest.register_node("bug_test:bug_test", {
	description = "Bug Test",
	on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
		local item = ItemStack("default:diamond 3")
		local inv = clicker:get_inventory()

		print("adding items")
		print(dump(inv:add_item("main", item):to_table()))

		return itemstack