Browse Source

Fix item container transfer destroying item metadata

tags/0.53.2
Wuzzy 8 months ago
parent
commit
fbba40fe5c
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      mods/CORE/mcl_util/init.lua

+ 4
- 3
mods/CORE/mcl_util/init.lua 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

Loading…
Cancel
Save