This will properly if the wielded spot is where the item is meant to go:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
on_punch = function(pos, node, player, pointed_thing)
local inv = player:get_inventory()
local left = inv:add_item("main", "default:dirt")
end,
This will not work if the wielded spot is where the item is meant to go:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local inv = player:get_inventory()
local left = inv:add_item("main", "default:dirt")
end,
Surprisingly add_item in on_rightclick is still returning true as if it did add the item. Is this an annoying feature that is meant to be this way or a bug? It would seem like a bug to me because it is inconsistent.