1
0
Fork 0

Fix item container transfer destroying item metadata

objects
Wuzzy 2019-04-05 15:30:32 +02:00
parent a7ceb2462a
commit fbba40fe5c
1 changed files with 4 additions and 3 deletions

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
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