1.7.10 compatibility

This commit is contained in:
kepler155c
2018-02-15 11:26:34 -05:00
parent 398e0bfaec
commit fe0ad66618

View File

@@ -81,6 +81,8 @@ function ChestAdapter:listItems()
local cache = { } local cache = { }
local items = { } local items = { }
-- getAllStacks sometimes fails
pcall(function()
for _,v in pairs(self.getAllStacks(false)) do for _,v in pairs(self.getAllStacks(false)) do
convertItem(v) convertItem(v)
local key = table.concat({ v.name, v.damage, v.nbtHash }, ':') local key = table.concat({ v.name, v.damage, v.nbtHash }, ':')
@@ -102,6 +104,7 @@ function ChestAdapter:listItems()
self.cache = cache self.cache = cache
return items return items
end end
end)
end end
function ChestAdapter:getItemInfo(item) function ChestAdapter:getItemInfo(item)
@@ -119,7 +122,8 @@ function ChestAdapter:craftItems()
end end
function ChestAdapter:provide(item, qty, slot, direction) function ChestAdapter:provide(item, qty, slot, direction)
for key,stack in pairs(self.getAllStacks(false)) do pcall(function()
for key,stack in Util.rpairs(self.getAllStacks(false)) do
if stack.id == item.name and if stack.id == item.name and
stack.dmg == item.damage and stack.dmg == item.damage and
stack.nbt_hash == item.nbtHash then stack.nbt_hash == item.nbtHash then
@@ -132,6 +136,7 @@ function ChestAdapter:provide(item, qty, slot, direction)
end end
end end
end end
end)
end end
function ChestAdapter:extract(slot, qty, toSlot) function ChestAdapter:extract(slot, qty, toSlot)