From 1f00136f42ecbe0123ed1b1845be3e20302741f1 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Fri, 4 Jan 2019 01:32:11 -0500 Subject: [PATCH] item get/add helper --- milo/apis/miniAdapter.lua | 13 ++----------- milo/plugins/turtleLearn.lua | 3 --- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/milo/apis/miniAdapter.lua b/milo/apis/miniAdapter.lua index f400cab..12a22e2 100644 --- a/milo/apis/miniAdapter.lua +++ b/milo/apis/miniAdapter.lua @@ -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 diff --git a/milo/plugins/turtleLearn.lua b/milo/plugins/turtleLearn.lua index b5c4ba2..1071297 100644 --- a/milo/plugins/turtleLearn.lua +++ b/milo/plugins/turtleLearn.lua @@ -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()