Fix replacements in Quick Crafting

This commit is contained in:
Jean-Patrick Guerrero 2023-03-05 14:24:16 +01:00
parent 7005794cc3
commit c9e02dfe09

View File

@ -1,7 +1,7 @@
local replacements = {fuel = {}} local replacements = {fuel = {}}
local http = ... local http = ...
IMPORT("maxn", "copy", "insert", "sort", "match", "sub") IMPORT("copy", "insert", "sort", "match", "sub")
IMPORT("true_str", "is_table", "valid_item", "table_merge", "table_replace", "table_eq") IMPORT("true_str", "is_table", "valid_item", "table_merge", "table_replace", "table_eq")
IMPORT("fmt", "reg_items", "reg_aliases", "reg_nodes", "is_cube", "get_cube", "ItemStack") IMPORT("fmt", "reg_items", "reg_aliases", "reg_nodes", "is_cube", "get_cube", "ItemStack")
IMPORT("is_group", "extract_groups", "item_has_groups", "groups_to_items", "get_group_stereotype") IMPORT("is_group", "extract_groups", "item_has_groups", "groups_to_items", "get_group_stereotype")
@ -178,13 +178,7 @@ local function cache_recipes(item)
_recipes[#recipes + 1 - k] = v _recipes[#recipes + 1 - k] = v
end end
local size_rpl = maxn(replacements[item])
local size_rcp = #_recipes
local shift = size_rcp - size_rpl
for k, v in pairs(replacements[item]) do for k, v in pairs(replacements[item]) do
k += shift
if _recipes[k] then if _recipes[k] then
_recipes[k].replacements = v _recipes[k].replacements = v
end end