From 64b49ba719b60bc232e63ee8337521008a2022c9 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Fri, 19 Mar 2021 14:58:25 +0100 Subject: [PATCH] try to fix give function --- mods/ITEMS/mcl_cauldrons/init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_cauldrons/init.lua b/mods/ITEMS/mcl_cauldrons/init.lua index 301ac3e5a..0f231be62 100644 --- a/mods/ITEMS/mcl_cauldrons/init.lua +++ b/mods/ITEMS/mcl_cauldrons/init.lua @@ -4,9 +4,9 @@ mcl_cauldrons = {} -- Cauldron mod, adds cauldrons. local function give_item(user, itemstack) - if itemstack and user:is_player() then - local inv = user:get_inventory() - if false then --minetest.is_creative_enabled(user:get_player_name()) then + local inv = user:get_inventory() + if inv then + --[[if false then --minetest.is_creative_enabled(user:get_player_name()) then if inv:contains_item("main", itemstack) then return false else @@ -16,13 +16,13 @@ local function give_item(user, itemstack) minetest.add_item(user:get_pos(), itemstack) end end + else]] + if inv:room_for_item("main", itemstack) then + inv:add_item("main", itemstack) else - if inv:room_for_item("main", itemstack) then - inv:add_item("main", itemstack) - else - minetest.add_item(user:get_pos(), itemstack) - end + minetest.add_item(user:get_pos(), itemstack) end + --end end return itemstack end