forked from LizzyFleckenstein03/Memeclone
Fix item container transfer destroying item metadata
This commit is contained in:
parent
a7ceb2462a
commit
fbba40fe5c
|
@ -174,14 +174,15 @@ function mcl_util.move_item(source_inventory, source_list, source_stack_id, dest
|
|||
|
||||
if not source_inventory:is_empty(source_list) then
|
||||
local stack = source_inventory:get_stack(source_list, source_stack_id)
|
||||
local item = stack:get_name()
|
||||
if not stack:is_empty() then
|
||||
if not destination_inventory:room_for_item(destination_list, item) then
|
||||
local new_stack = ItemStack(stack)
|
||||
new_stack:set_count(1)
|
||||
if not destination_inventory:room_for_item(destination_list, new_stack) then
|
||||
return false
|
||||
end
|
||||
stack:take_item()
|
||||
source_inventory:set_stack(source_list, source_stack_id, stack)
|
||||
destination_inventory:add_item(destination_list, item)
|
||||
destination_inventory:add_item(destination_list, new_stack)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue