mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
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 <wiktor_t-i@proton.me> Co-committed-by: the-real-herowl <wiktor_t-i@proton.me>
This commit is contained in:
parent
a499d292f8
commit
cb4396d424
@ -66,13 +66,15 @@ function mcl_stonecutter.register_recipe(input, output, count)
|
|||||||
local fallthrough = mcl_stonecutter.registered_recipes[output]
|
local fallthrough = mcl_stonecutter.registered_recipes[output]
|
||||||
if fallthrough then
|
if fallthrough then
|
||||||
for o, c in pairs(fallthrough) do
|
for o, c in pairs(fallthrough) do
|
||||||
|
if not mcl_stonecutter.registered_recipes[input][o] then
|
||||||
mcl_stonecutter.register_recipe(input, o, c * count)
|
mcl_stonecutter.register_recipe(input, o, c * count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for i, recipes in pairs(mcl_stonecutter.registered_recipes) do
|
for i, recipes in pairs(mcl_stonecutter.registered_recipes) do
|
||||||
for name, c in pairs(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)
|
mcl_stonecutter.register_recipe(i, output, c * count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user