Guest User

regulate

a guest
Aug 26th, 2016
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.98 KB | None | 0 0
  1. -- Variables
  2.  
  3. local me = peripheral.wrap("right")
  4. local list = me.getAvailableItems()
  5. local itemID = ""
  6. local amt = 0
  7. local maxAmt = 0
  8.  
  9.  
  10. -- Functions
  11.  
  12. function export(itemID, amt)
  13.     local amt = amt
  14.     for number, item in pairs(list) do
  15.         if item.fingerprint.id == itemID then
  16.             if amt > 64 then
  17.                 while amt > 64 do  
  18.                     me.exportItem(item.fingerprint, "SOUTH", amt)
  19.                     amt = amt - 64
  20.                 end
  21.                 me.exportItem(item.fingerprint, "SOUTH", amt)
  22.             else
  23.                 me.exportItem(item.fingerprint, "SOUTH", amt)
  24.             end
  25.         end
  26.     end
  27. end
  28.  
  29. function exportExcess(itemID, maxAmt)
  30.     list = me.getAvailableItems()
  31.     for number, item in pairs(list) do
  32.         if item.fingerprint.id == itemID then
  33.             if item.size >  maxAmt then
  34.                 print("Condensing "..item.size-maxAmt.." "..itemID)
  35.     export(itemID, item.size-maxAmt)
  36.             end
  37.         end
  38.     end
  39. end
  40.    
  41.    
  42. -- Main code
  43.  
  44. while true do
  45.     term.clear()
  46.     term.setCursorPos(1,1)
  47.     exportExcess("minecraft:cobblestone", 500000)
  48.     os.sleep(10)
  49. end
Advertisement
Add Comment
Please, Sign In to add comment