1.7.10 compatibility
This commit is contained in:
@@ -124,9 +124,9 @@ end
|
|||||||
function ChestAdapter:provide(item, qty, slot, direction)
|
function ChestAdapter:provide(item, qty, slot, direction)
|
||||||
pcall(function()
|
pcall(function()
|
||||||
for key,stack in Util.rpairs(self.getAllStacks(false)) do
|
for key,stack in Util.rpairs(self.getAllStacks(false)) do
|
||||||
if stack.name == item.name and
|
if stack.id == item.name and
|
||||||
(not item.damage or stack.damage == item.damage) and
|
(not item.damage or stack.dmg == item.damage) and
|
||||||
(not item.nbtHash or stack.nbtHash == item.nbtHash) then
|
(not item.nbtHash or stack.nbt_hash == item.nbtHash) then
|
||||||
local amount = math.min(qty, stack.qty)
|
local amount = math.min(qty, stack.qty)
|
||||||
if amount > 0 then
|
if amount > 0 then
|
||||||
self.pushItemIntoSlot(direction or self.direction, key, amount, slot)
|
self.pushItemIntoSlot(direction or self.direction, key, amount, slot)
|
||||||
@@ -140,6 +140,18 @@ function ChestAdapter:provide(item, qty, slot, direction)
|
|||||||
end)
|
end)
|
||||||
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)
|
function ChestAdapter:extract(slot, qty, toSlot)
|
||||||
if toSlot then
|
if toSlot then
|
||||||
self.pushItemIntoSlot(self.direction, slot, qty, toSlot)
|
self.pushItemIntoSlot(self.direction, slot, qty, toSlot)
|
||||||
|
|||||||
Reference in New Issue
Block a user