crafter bug fixes
This commit is contained in:
@@ -85,21 +85,23 @@ function ChestAdapter:listItems(throttle)
|
|||||||
-- getAllStacks sometimes fails
|
-- getAllStacks sometimes fails
|
||||||
pcall(function()
|
pcall(function()
|
||||||
for _,v in pairs(self.getAllStacks(false)) do
|
for _,v in pairs(self.getAllStacks(false)) do
|
||||||
convertItem(v)
|
if v.count > 0 then
|
||||||
local key = table.concat({ v.name, v.damage, v.nbtHash }, ':')
|
convertItem(v)
|
||||||
|
local key = table.concat({ v.name, v.damage, v.nbtHash }, ':')
|
||||||
|
|
||||||
local entry = cache[key]
|
local entry = cache[key]
|
||||||
if not entry then
|
if not entry then
|
||||||
entry = itemDB:get(v) or itemDB:add(v)
|
entry = itemDB:get(v) or itemDB:add(v)
|
||||||
entry = Util.shallowCopy(entry)
|
entry = Util.shallowCopy(entry)
|
||||||
entry.count = 0
|
entry.count = 0
|
||||||
cache[key] = entry
|
cache[key] = entry
|
||||||
table.insert(items, entry)
|
table.insert(items, entry)
|
||||||
|
end
|
||||||
|
entry.count = entry.count + v.count
|
||||||
|
throttle()
|
||||||
end
|
end
|
||||||
entry.count = entry.count + v.count
|
itemDB:flush()
|
||||||
throttle()
|
|
||||||
end
|
end
|
||||||
itemDB:flush()
|
|
||||||
end)
|
end)
|
||||||
if not Util.empty(items) then
|
if not Util.empty(items) then
|
||||||
self.cache = cache
|
self.cache = cache
|
||||||
|
|||||||
@@ -595,6 +595,7 @@ end
|
|||||||
|
|
||||||
function itemPage.form.info:draw()
|
function itemPage.form.info:draw()
|
||||||
local recipe = recipes[uniqueKey(itemPage.item)]
|
local recipe = recipes[uniqueKey(itemPage.item)]
|
||||||
|
self.value = ''
|
||||||
if recipe and itemPage.item.machine then
|
if recipe and itemPage.item.machine then
|
||||||
self.value = string.format('Crafts %d using the %s machine',
|
self.value = string.format('Crafts %d using the %s machine',
|
||||||
recipe.count,
|
recipe.count,
|
||||||
@@ -603,6 +604,13 @@ function itemPage.form.info:draw()
|
|||||||
UI.TextArea.draw(self)
|
UI.TextArea.draw(self)
|
||||||
end
|
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)
|
function itemPage.machines:eventHandler(event)
|
||||||
if event.type == 'grid_focus_row' then
|
if event.type == 'grid_focus_row' then
|
||||||
@@ -637,6 +645,8 @@ function itemPage:eventHandler(event)
|
|||||||
if index then
|
if index then
|
||||||
self.machines.grid:setIndex(index)
|
self.machines.grid:setIndex(index)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
self.machines.grid:setIndex(1)
|
||||||
end
|
end
|
||||||
self.machines:show()
|
self.machines:show()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user