Fix item container transfer destroying item metadata

This commit is contained in:
Wuzzy 2019-04-05 15:30:32 +02:00
parent a7ceb2462a
commit fbba40fe5c

View File

@ -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 if not source_inventory:is_empty(source_list) then
local stack = source_inventory:get_stack(source_list, source_stack_id) local stack = source_inventory:get_stack(source_list, source_stack_id)
local item = stack:get_name()
if not stack:is_empty() then 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 return false
end end
stack:take_item() stack:take_item()
source_inventory:set_stack(source_list, source_stack_id, stack) 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 return true
end end
end end