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

View File

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