From d7b91eca7b80c490a3f37cbb783c599ea256cc83 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Sat, 17 Feb 2018 01:48:34 -0500 Subject: [PATCH] 1.7.10 compatibility --- apis/chestAdapter.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/apis/chestAdapter.lua b/apis/chestAdapter.lua index 6953b73..76e5de8 100644 --- a/apis/chestAdapter.lua +++ b/apis/chestAdapter.lua @@ -124,9 +124,9 @@ end function ChestAdapter:provide(item, qty, slot, direction) pcall(function() for key,stack in Util.rpairs(self.getAllStacks(false)) do - if stack.name == item.name and - (not item.damage or stack.damage == item.damage) and - (not item.nbtHash or stack.nbtHash == item.nbtHash) then + if stack.id == item.name and + (not item.damage or stack.dmg == item.damage) and + (not item.nbtHash or stack.nbt_hash == item.nbtHash) then local amount = math.min(qty, stack.qty) if amount > 0 then self.pushItemIntoSlot(direction or self.direction, key, amount, slot) @@ -140,6 +140,18 @@ function ChestAdapter:provide(item, qty, slot, direction) end) end +function ChestAdapter:eject(item, qty, direction) + if not _G.turtle then + error('Only a turtle can eject') + end + + local s, m = pcall(function() + self:provide(item, qty) + _G.turtle.emptyInventory() + end) + return s, m +end + function ChestAdapter:extract(slot, qty, toSlot) if toSlot then self.pushItemIntoSlot(self.direction, slot, qty, toSlot)