From f88e0412fc51e3c9a936bb0dfb57a91ff583e395 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sun, 26 Jul 2020 16:22:04 +0200 Subject: [PATCH] Fix replacements --- init.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 38b9bef..219a2a9 100644 --- a/init.lua +++ b/init.lua @@ -709,8 +709,14 @@ local function cache_recipes(item) _recipes[#recipes + 1 - k] = v end + local shift = 0 + + if maxn(replacements[item]) > #_recipes then + shift = -1 + end + for k, v in pairs(replacements[item]) do - _recipes[k].replacements = v + _recipes[k + shift].replacements = v end recipes = _recipes