NiallDoherty

DumbSort

May 17th, 2021 (edited)
702
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local ender = peripheral.wrap("top")
  2.  
  3. local controller = peripheral.wrap("bottom")
  4.  
  5. local chest = peripheral.wrap("right")
  6.  
  7. local function moveItem(slot)
  8.     remainder = ender.pushItems(controller, slot)
  9.     if remainder > 0
  10.        return ender.pushItems(chest, slot)
  11.     end
  12.     return 0
  13. end
  14.  
  15. local function moveItems()
  16.     for i = 1, ender.size() do
  17.         item = ender.getItemDetail(i)
  18.         if item then
  19.             if moveItem(item.name, i) < item.count then
  20.                 print("No space for: " .. item.name)
  21.             end
  22.         end
  23.     end
  24. end
  25.  
  26. while true do
  27.     moveItems()
  28.     sleep(1)
  29. end
RAW Paste Data