diff --git a/apis/chestAdapter.lua b/apis/chestAdapter.lua index bb55a25..3b4cfde 100644 --- a/apis/chestAdapter.lua +++ b/apis/chestAdapter.lua @@ -85,21 +85,23 @@ function ChestAdapter:listItems(throttle) -- getAllStacks sometimes fails pcall(function() for _,v in pairs(self.getAllStacks(false)) do - convertItem(v) - local key = table.concat({ v.name, v.damage, v.nbtHash }, ':') + if v.count > 0 then + convertItem(v) + local key = table.concat({ v.name, v.damage, v.nbtHash }, ':') - local entry = cache[key] - if not entry then - entry = itemDB:get(v) or itemDB:add(v) - entry = Util.shallowCopy(entry) - entry.count = 0 - cache[key] = entry - table.insert(items, entry) + local entry = cache[key] + if not entry then + 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 - entry.count = entry.count + v.count - throttle() + itemDB:flush() end - itemDB:flush() end) if not Util.empty(items) then self.cache = cache diff --git a/apps/Crafter.lua b/apps/Crafter.lua index dd9f285..468a14e 100644 --- a/apps/Crafter.lua +++ b/apps/Crafter.lua @@ -595,6 +595,7 @@ end function itemPage.form.info:draw() local recipe = recipes[uniqueKey(itemPage.item)] + self.value = '' if recipe and itemPage.item.machine then self.value = string.format('Crafts %d using the %s machine', recipe.count, @@ -603,6 +604,13 @@ function itemPage.form.info:draw() UI.TextArea.draw(self) end +function itemPage.machines.grid:getRowTextColor(row, selected) + if itemPage.item.machine and self.item.machine.order == row.order then + return colors.yellow + end + return UI.Grid:getRowTextColor(row, selected) +end + --[[ function itemPage.machines:eventHandler(event) if event.type == 'grid_focus_row' then @@ -637,6 +645,8 @@ function itemPage:eventHandler(event) if index then self.machines.grid:setIndex(index) end + else + self.machines.grid:setIndex(1) end self.machines:show()