Fix creative handling for itemframe

This commit is contained in:
Wuzzy 2020-07-10 18:07:21 +02:00
parent ec660d73c9
commit b7e4a1e9b5

View File

@ -87,8 +87,12 @@ local update_item_entity = function(pos, node, param2)
end end
end end
local drop_item = function(pos, node, meta) local drop_item = function(pos, node, meta, clicker)
if node.name == "mcl_itemframes:item_frame" and not minetest.is_creative_enabled("") then local cname = ""
if clicker and clicker:is_player() then
cname = clicker:get_player_name()
end
if node.name == "mcl_itemframes:item_frame" and not minetest.is_creative_enabled(cname) then
local inv = meta:get_inventory() local inv = meta:get_inventory()
local item = inv:get_stack("main", 1) local item = inv:get_stack("main", 1)
if not item:is_empty() then if not item:is_empty() then
@ -132,7 +136,7 @@ minetest.register_node("mcl_itemframes:item_frame",{
return return
end end
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
drop_item(pos, node, meta) drop_item(pos, node, meta, clicker)
local inv = meta:get_inventory() local inv = meta:get_inventory()
if itemstack:is_empty() then if itemstack:is_empty() then
remove_item_entity(pos, node) remove_item_entity(pos, node)