Skip to content

Commit

Permalink
Autocrafting: Fetch item list before removing items from inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
random-geek committed Mar 22, 2019
1 parent cc741a7 commit 5396c45
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autocrafting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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
Expand Down

0 comments on commit 5396c45

Please sign in to comment.