From a711c7bdb7b8ac006d5d71b5a64f753a132745fb Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 1 Mar 2019 17:30:21 +0100 Subject: [PATCH] handle_node_drops no longer destroys metadata --- mods/ENTITIES/mcl_item_entity/init.lua | 10 +++++----- mods/HUD/mcl_inventory/creative.lua | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index d1c502fce..4b10cdac7 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -245,16 +245,16 @@ function minetest.handle_node_drops(pos, drops, digger) end for _,item in ipairs(drops) do - local count, name + local count if type(item) == "string" then - count = 1 - name = item + count = ItemStack(item):get_count() else count = item:get_count() - name = item:get_name() end + local drop_item = ItemStack(item) + drop_item:set_count(1) for i=1,count do - local obj = core.add_item(pos, name) + local obj = core.add_item(pos, drop_item) if obj ~= nil then local x = math.random(1, 5) if math.random(1,2) == 1 then diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 7125dcb65..dd5d0bd87 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -555,8 +555,7 @@ if minetest.settings:get_bool("creative_mode") then local inv = digger:get_inventory() if inv then for _,item in ipairs(drops) do - item = ItemStack(item):get_name() - if not inv:contains_item("main", item) then + if not inv:contains_item("main", item, true) then inv:add_item("main", item) end end