1.7.10 compatibility

This commit is contained in:
kepler155c
2018-02-20 23:59:33 -05:00
parent 6eff117d4a
commit 3e8b01be93
2 changed files with 10 additions and 9 deletions

View File

@@ -77,9 +77,10 @@ function ChestAdapter:refresh(throttle)
end
-- provide a consolidated list of items
function ChestAdapter:listItems()
function ChestAdapter:listItems(throttle)
local cache = { }
local items = { }
throttle = throttle or Util.throttle()
-- getAllStacks sometimes fails
pcall(function()
@@ -89,15 +90,14 @@ function ChestAdapter:listItems()
local entry = cache[key]
if not entry then
cache[key] = v
if not itemDB:get(v) then
itemDB:add(v)
end
table.insert(items, v)
else
entry.count = entry.count + v.count
entry = itemDB:get(v) or itemDB:add(v)
entry = Util.shallowCopy(entry)
entry.count = 0
cache[key] = entry
table.insert(items, entry)
end
entry.count = entry.count + v.count
throttle()
end
itemDB:flush()
end)

View File

@@ -1091,6 +1091,7 @@ local function learnRecipe(page)
listingPage:refresh()
listingPage.grid:draw()
inventoryAdapter:eject(recipe, recipe.count, 'front')
return true
end
else