DuckStrom

Computercraft / LP chest dumper

Mar 26th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. dir = "up" -- direction of interface relative to ender chest
  2. c = peripheral.find("ender_chest")
  3.  
  4. blacklist = {
  5.   ["LogisticsPipes:item.remoteOrdererItem"]={-1},
  6.   ["ChromatiCraft:chromaticraft_item_aurapouch"]={-1},
  7.   ["ThaumicTinkerer:ichorPouch"]={-1},
  8.   ["EnderStorage:enderPouch"]={-1},
  9.   ["Backpack:backpack"]={-1},
  10. }
  11.  
  12. function isBlacklisted(name,ID)
  13.   if blacklist[name] ~= nil then
  14.     if blacklist[name][1] == -1 then
  15.       return true
  16.     end
  17.     for k,v in ipairs(blacklist[name]) do
  18.       if v == ID then
  19.         return true
  20.       end
  21.     end
  22.   end
  23.   return false
  24. end
  25.  
  26. while true do
  27.   local success, item = pcall(c.getStackInSlot, 26)
  28.   if success == false or item ~= nil then
  29.     if not isBlacklisted(item.id, item.dmb) then
  30.       c.pushItem(dir, 26, 64, 0)
  31.     end
  32.   end
  33.  
  34.   success, item = pcall(c.getStackInSlot, 27)
  35.   if success == false or item ~= nil then
  36.     for i = 1, 27, 1 do
  37.       local success, item = pcall(c.getStackInSlot, i)
  38.       if success == false or item ~= nil and not isBlacklisted(item.id, item.dmg) then
  39.         c.pushItem(dir, i, 64, i%8)
  40.       end
  41.     end
  42.     -- print("[" .. textutils.formatTime(os.time(), true) .. "] Inventory dumped")
  43.   end
  44.  
  45.   sleep(0.1)
  46. end
Add Comment
Please, Sign In to add comment