From 204777ba4127ae00f62c8dda79661a87f41c5d3b Mon Sep 17 00:00:00 2001 From: kepler155c Date: Fri, 16 Feb 2018 23:17:31 -0500 Subject: [PATCH] 1.7.10 compatibility --- apis/chestAdapter.lua | 11 ++++++----- apps/chestManager.lua | 2 +- apps/persist.lua | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apis/chestAdapter.lua b/apis/chestAdapter.lua index 02c2625..6953b73 100644 --- a/apis/chestAdapter.lua +++ b/apis/chestAdapter.lua @@ -124,12 +124,13 @@ end function ChestAdapter:provide(item, qty, slot, direction) pcall(function() for key,stack in Util.rpairs(self.getAllStacks(false)) do - if stack.id == item.name and - stack.dmg == item.damage and - stack.nbt_hash == item.nbtHash then - + if stack.name == item.name and + (not item.damage or stack.damage == item.damage) and + (not item.nbtHash or stack.nbtHash == item.nbtHash) then local amount = math.min(qty, stack.qty) - self.pushItemIntoSlot(direction or self.direction, key, amount, slot) + if amount > 0 then + self.pushItemIntoSlot(direction or self.direction, key, amount, slot) + end qty = qty - amount if qty <= 0 then break diff --git a/apps/chestManager.lua b/apps/chestManager.lua index 52060b9..7a55c90 100644 --- a/apps/chestManager.lua +++ b/apps/chestManager.lua @@ -913,7 +913,7 @@ function listingPage:eventHandler(event) if canLearn then UI:setPage('learn') else - self.notification:error('Missing a crafting chest\nCheck configuration') + self.notification:error('Missing a crafting chest or workbench\nCheck configuration') end elseif event.type == 'craft' or event.type == 'grid_select_right' then diff --git a/apps/persist.lua b/apps/persist.lua index 3df928c..2c85f0e 100644 --- a/apps/persist.lua +++ b/apps/persist.lua @@ -12,7 +12,7 @@ local fileName = args[1] and shell.resolve(args[1]) or error('Syntax: persist ') -local c = Util.readFile() or error('Unable to read file') +local c = Util.readFile(fileName) or error('Unable to read file') -- ensure it is writable - if not an error is thrown Util.writeFile(fileName, '')