From 5396c459208d4df823ee79c75a53e544f08857fc Mon Sep 17 00:00:00 2001 From: random-geek <35757396+random-geek@users.noreply.github.com> Date: Thu, 21 Mar 2019 18:16:03 -0700 Subject: [PATCH] Autocrafting: Fetch item list before removing items from inventory --- autocrafting.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autocrafting.lua b/autocrafting.lua index 1227443..627293e 100644 --- a/autocrafting.lua +++ b/autocrafting.lua @@ -101,6 +101,7 @@ cg.auto_craft = function(player, craft, num) if craft.width > inv:get_width("craft") or table.maxn(craft.items) > inv:get_size("craft") then return end + local invList = inv:get_list("main") local width = craft.width == 0 and inv:get_width("craft") or craft.width local stack, invCache local groupCache = {} @@ -114,7 +115,7 @@ cg.auto_craft = function(player, craft, num) if not invCache then invCache = {} - for _, stack in ipairs(inv:get_list("main")) do + for _, stack in ipairs(invList) do if stack:get_count() > 0 then add_or_create(invCache, stack:get_name(), stack:get_count()) end