From e0cb50a279728e1c59b17aba43a0b3b6cd965793 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 3 Jul 2017 00:22:21 +0200 Subject: [PATCH] Don't destroy metadata if place item in itemframe --- mods/ITEMS/itemframes/init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/itemframes/init.lua b/mods/ITEMS/itemframes/init.lua index bed7a2e4..90a31bff 100644 --- a/mods/ITEMS/itemframes/init.lua +++ b/mods/ITEMS/itemframes/init.lua @@ -78,9 +78,11 @@ end local drop_item = function(pos, node, meta) if meta:get_string("item") ~= "" then if node.name == "itemframes:frame" and not minetest.setting_getbool("creative_mode") then - minetest.add_item(pos, meta:get_string("item")) + local item = ItemStack(minetest.deserialize(meta:get_string("itemdata"))) + minetest.add_item(pos, item) end meta:set_string("item","") + meta:set_string("itemdata","") end remove_item(pos, node) end @@ -111,7 +113,11 @@ minetest.register_node("itemframes:frame",{ local meta = minetest.get_meta(pos) if clicker:get_player_name() == meta:get_string("owner") then drop_item(pos, node, meta) + -- item holds the itemstring meta:set_string("item", itemstack:get_name()) + local itemdata = minetest.serialize(itemstack:to_table()) + -- itemdata holds the serialized itemstack in table form + meta:set_string("itemdata", itemdata) update_item(pos,node) if not minetest.setting_getbool("creative_mode") then itemstack:take_item()