item get/add helper
This commit is contained in:
@@ -24,19 +24,10 @@ function Adapter:listItems(throttle)
|
||||
local key = table.concat({ v.name, v.damage, v.nbtHash }, ':')
|
||||
|
||||
local entry = cache[key]
|
||||
if not entry then
|
||||
local cached = itemDB:get(v, function() return self.getItemMeta(k) end)
|
||||
if cached then
|
||||
entry = cached
|
||||
entry.count = 0
|
||||
cache[key] = entry
|
||||
else
|
||||
_G._debug('Adapter: failed to get item details')
|
||||
end
|
||||
end
|
||||
|
||||
if entry then
|
||||
entry.count = entry.count + v.count
|
||||
else
|
||||
cache[key] = itemDB:get(v, function() return self.getItemMeta(k) end)
|
||||
end
|
||||
throttle()
|
||||
end
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local Craft = require('craft2')
|
||||
local itemDB = require('itemDB')
|
||||
local Milo = require('milo')
|
||||
local UI = require('ui')
|
||||
@@ -7,8 +6,6 @@ local Util = require('util')
|
||||
local colors = _G.colors
|
||||
local turtle = _G.turtle
|
||||
|
||||
local context = Milo:getContext()
|
||||
|
||||
local function learnRecipe()
|
||||
local ingredients = Milo:getTurtleInventory()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user