diff --git a/apis/builder/turtle.lua b/apis/builder/turtle.lua index d090719..d85640c 100644 --- a/apis/builder/turtle.lua +++ b/apis/builder/turtle.lua @@ -348,23 +348,25 @@ function TurtleBuilder:dumpInventoryWithCheck() end function TurtleBuilder:autocraft(supplies) - local t = { } + if self.itemAdapter.craftItems then + local t = { } - for _,s in pairs(supplies) do - local key = s.id .. ':' .. s.dmg - local item = t[key] - if not item then - item = { - id = s.id, - dmg = s.dmg, - qty = 0, - } - t[key] = item + for _,s in pairs(supplies) do + local key = s.id .. ':' .. s.dmg + local item = t[key] + if not item then + item = { + id = s.id, + dmg = s.dmg, + qty = 0, + } + t[key] = item + end + item.qty = item.qty + (s.need - s.qty) end - item.qty = item.qty + (s.need - s.qty) - end - self.itemAdapter:craftItems(convertForward(t)) + self.itemAdapter:craftItems(convertForward(t)) + end end function TurtleBuilder:getSupplies() diff --git a/apis/chestAdapter.lua b/apis/chestAdapter.lua index 189ef59..71bffc9 100644 --- a/apis/chestAdapter.lua +++ b/apis/chestAdapter.lua @@ -122,12 +122,6 @@ function ChestAdapter:getItemInfo(item) return self.cache[key] end -function ChestAdapter:craft() -end - -function ChestAdapter:craftItems() -end - function ChestAdapter:provide(item, qty, slot, direction) pcall(function() for key,stack in Util.rpairs(self.getAllStacks(false)) do diff --git a/apis/chestAdapter18.lua b/apis/chestAdapter18.lua index 7d8238a..5c4425a 100644 --- a/apis/chestAdapter18.lua +++ b/apis/chestAdapter18.lua @@ -113,12 +113,6 @@ function ChestAdapter:getItemInfo(item) return self.cache[key] end -function ChestAdapter:craft() -end - -function ChestAdapter:craftItems() -end - function ChestAdapter:getPercentUsed() if self.cache and self.getDrawerCount then return math.floor(Util.size(self.cache) / self.getDrawerCount() * 100) diff --git a/apps/builder.lua b/apps/builder.lua index 8969781..04c5d32 100644 --- a/apps/builder.lua +++ b/apps/builder.lua @@ -377,7 +377,7 @@ function listingPage:eventHandler(event) if item and item.is_craftable then local qty = math.max(0, s.need - item.qty) - if item then + if item and Builder.itemAdapter.craftItems then Builder.itemAdapter:craftItems({{ name = s.id, damage = s.dmg, nbtHash = s.nbt_hash, count = qty }}) local name = s.display_name or s.id self.statusBar:timedStatus('Requested ' .. qty .. ' ' .. name, 3)