From cb4396d424b3500743fc1d9cccc8e49a8c1fc39f Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Fri, 24 May 2024 10:31:27 +0000 Subject: [PATCH] Fix stonecutter warnings (#4315) This fixes faulty fallthrough mechanisms attempting to register the same recipe more than once in some cases. This fixes the warning spam when entering a world, while keeping the warnings for mods that misuse the Stonecutter API. Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4315 Co-authored-by: the-real-herowl Co-committed-by: the-real-herowl --- mods/ITEMS/mcl_stonecutter/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_stonecutter/init.lua b/mods/ITEMS/mcl_stonecutter/init.lua index 9284d2a9c..0b2f6f166 100644 --- a/mods/ITEMS/mcl_stonecutter/init.lua +++ b/mods/ITEMS/mcl_stonecutter/init.lua @@ -66,13 +66,15 @@ function mcl_stonecutter.register_recipe(input, output, count) local fallthrough = mcl_stonecutter.registered_recipes[output] if fallthrough then for o, c in pairs(fallthrough) do - mcl_stonecutter.register_recipe(input, o, c * count) + if not mcl_stonecutter.registered_recipes[input][o] then + mcl_stonecutter.register_recipe(input, o, c * count) + end end end for i, recipes in pairs(mcl_stonecutter.registered_recipes) do for name, c in pairs(recipes) do - if name == input then + if name == input and not mcl_stonecutter.registered_recipes[i][output] then mcl_stonecutter.register_recipe(i, output, c * count) end end