item get/add helper

This commit is contained in:
kepler155c@gmail.com
2019-01-04 01:32:11 -05:00
parent 6606975f5b
commit 1f00136f42
2 changed files with 2 additions and 14 deletions

View File

@@ -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

View File

@@ -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()