mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 12:31:05 +01:00
Fix item container transfer destroying item metadata
This commit is contained in:
parent
a7ceb2462a
commit
fbba40fe5c
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue