mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 02:21:06 +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
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||||
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
|
||||||
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 a new issue