From 937b40aae4df5b49c7aa787d623304259a09df1f Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Tue, 17 Dec 2019 01:46:22 +0100 Subject: [PATCH] Remove recipe from caches after calling clear_craft() --- init.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/init.lua b/init.lua index 86a622a..10837ae 100644 --- a/init.lua +++ b/init.lua @@ -1249,6 +1249,20 @@ core.register_craft = function(def) end end +local old_clear_craft = core.clear_craft + +core.clear_craft = function(def) + old_clear_craft(def) + + if true_str(def) then + recipes_cache[def] = nil + fuel_cache[def] = nil + + elseif is_table(def) then + return -- TODO + end +end + local function handle_drops_table(name, drop) -- Code borrowed and modified from unified_inventory -- https://github.com/minetest-mods/unified_inventory/blob/master/api.lua