Advertisement
zPandro

Untitled-9

Jul 5th, 2021
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. local SLOT_COUNT = 16
  2. local E_Orb = peripheral.wrap("bottom")
  3.  
  4.  
  5. function dropItems(orb)
  6.     item = orb.getItemDetail(2)
  7.     if(item == nil) then
  8.         for slot = 1, SLOT_COUNT, 1 do
  9.             local item = turtle.getItemDetail(slot)
  10.             if(item ~= nil) then
  11.                 if (item["name"] == "minecraft:redstone_block") then
  12.                     turtle.select(slot)
  13.                     turtle.dropDown(2)
  14.                 else
  15.                     turtle.select(slot)
  16.                     turtle.dropDown(1)
  17.                 end
  18.             end
  19.         end
  20.         return true
  21.     else
  22.         return false
  23.     end
  24. end
  25.  
  26. function handleResults(orb)
  27.     working = true
  28.     while (working) do
  29.         resultSlot = orb.getItemDetail(1)
  30.         if (resultSlot ~= nil) then
  31.             turtle.select(16)
  32.             turtle.suckDown()
  33.             turtle.dropUp()
  34.             turtle.select(1)
  35.             working = false
  36.         end
  37.     end
  38. end
  39.  
  40. while true do
  41.     local event, p1 = os.pullEvent("turtle_inventory")
  42.     local dropResult = dropItems(E_Orb)
  43.     print(dropResult)
  44.     if (dropResult) then
  45.         handleResults(E_Orb)
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement