MineMcMine

StockKeeper

Apr 28th, 2022 (edited)
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.     Using: CC: Tweaked, Plethora
  3.     pastebin run Fa8bHCut
  4.     pastebin get Fa8bHCut startup
  5. ]]--
  6.  
  7. if pcall(os.loadAPI, "jLib/jFuncs") then
  8. else
  9.     shell.run("pastebin get kqBFGcfV jLib/jFuncs")
  10.     os.loadAPI("jLib/jFuncs")
  11. end
  12.  
  13. local input = peripheral.find("appliedenergistics2:interface")
  14. --local output = peripheral.find("minecraft:ironchest_diamond")
  15. local output = peripheral.find("danknull:danknull_dock")
  16.  
  17. local countLimit = 10000
  18.  
  19. local function getAllOutput()
  20.     local meta
  21.     local ret = {}
  22.     output = peripheral.find("danknull:danknull_dock")
  23.     if(not output.list) then
  24.         return nil
  25.     end
  26.     for i, item in pairs(output.list()) do
  27.         if(item.count < countLimit) then
  28.             ret[i] = item
  29.         end
  30.     end
  31.     return ret
  32. end
  33.  
  34. local function getItems(toMove)
  35.     local inputMeta
  36.     for i, inputItem in pairs(input.list()) do
  37.         for _, itemToMove in pairs(toMove) do
  38.             if(jFuncs.itemsEqual(itemToMove, inputItem)) then
  39.                 output = peripheral.find("danknull:danknull_dock")
  40.                 if(output.pullItems) then
  41.                     output.pullItems(peripheral.getName(input), i)
  42.                 else
  43.                     return false
  44.                 end
  45.             end
  46.         end
  47.     end
  48.     return true
  49. end
  50.  
  51. local toMove
  52. while(true) do
  53.     toMove = getAllOutput()
  54.     if(toMove) then
  55.         if(not getItems(toMove)) then
  56.             os.sleep(1)
  57.         end
  58.     else
  59.         os.sleep(1)
  60.     end
  61. end
  62.  
Add Comment
Please, Sign In to add comment