augustclear

Compressence

Dec 6th, 2021 (edited)
704
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local direction = "up"
  2. local emptyflag = 0
  3.  
  4. local function suck()
  5.     if direction == "up" then
  6.         turtle.suckDown(1)
  7.     else
  8.         turtle.suckUp(1)
  9.     end
  10. end
  11.  
  12. local function move_items(pos1,pos2)
  13.     turtle.select(pos1)
  14.     turtle.transferTo(pos2)
  15. end
  16.  
  17. local function drop(side)
  18.   turtle.select(1)
  19.   if side == "up" then
  20.     turtle.dropUp()
  21.   elseif side == "down" then
  22.     turtle.dropDown()
  23.   else
  24.     for i=1,16 do
  25.       if i~=6 then
  26.         turtle.select(i)
  27.         turtle.drop()
  28.       end
  29.     end
  30.   end
  31. end
  32.  
  33. local function fillCraft()
  34.     turtle.select(2)
  35.     suck()
  36.     turtle.select(5)
  37.     suck()
  38.     turtle.select(7)
  39.     suck()
  40.     turtle.select(10)
  41.     suck()
  42. end
  43.  
  44. -- Main Code
  45.  
  46. turtle.select(1)
  47. turtle.turnLeft()
  48. turtle.turnLeft()
  49. while turtle.suck() == true do
  50.     turtle.dropDown()
  51. end
  52. turtle.turnLeft()
  53. turtle.turnLeft()
  54.  
  55. while true do
  56.   fillCraft()
  57.   turtle.select(1)
  58.   if turtle.craft(1) == false then
  59.     drop("forward")
  60.     emptyflag = emptyflag + 1
  61.     if direction == "up" then
  62.       direction = "down"
  63.     else
  64.       direction = "up"
  65.     end
  66.   else
  67.     emptyflag = 0
  68.     drop(direction)
  69.   end
  70.   if emptyflag > 2 then
  71.     break      
  72.   end
  73. end
RAW Paste Data