Talk:InvRef
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
please add something like room_for_items() to test if more items can find place in the inventory Hybrid Dog (talk) 14:21, 10 May 2014 (MSK)
on_drop = function(itemstack, dropper)
local inv = dropper:get_inventory()
if not inv then
return
end
local free_slots = 0
for _,i in ipairs(inv:get_list("main")) do
if i:get_count() == 0 then
free_slots = free_slots+1
end
end
if free_slots < 2 then
return
end
itemstack:take_item()
inv:add_item("main", "nether:fruit_leaf")
inv:add_item("main", "nether:fruit_no_leaf")
return itemstack
end,
I need to do it this way instead. Hybrid Dog (talk) 14:44, 10 May 2014 (MSK)