Advertisement
gstultz

TreeFarm

Jan 18th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. function getMeal()
  2.     turtle.turnRight()
  3.     turtle.select(3)
  4.     turtle.suck()
  5.     turtle.turnLeft()
  6. end
  7.  
  8. function deposit()
  9.     sap = turtle.getItemCount(1) - 2
  10.     wood = turtle.getItemCount(2) - 1
  11.  
  12.     turtle.turnLeft()
  13.     turtle.turnLeft()
  14.     turtle.select(2)
  15.     turtle.drop(sap)
  16.     turtle.select(1)
  17.     turtle.drop(wood)
  18.     turtle.turnRight()
  19.     turtle.turnRight()
  20. end
  21.  
  22. function breakTree()
  23.     while turtle.detectUp() do
  24.         turtle.digUp()
  25.         turtle.up()
  26.     end
  27.        
  28.     while not turtle.detectDown() do
  29.         turtle.down()
  30.     end
  31. end
  32.  
  33. while turtle.getFuelLevel() > 100 do
  34.  
  35.     if turtle.getItemCount(3) == 1 then
  36.         break
  37.     end
  38.    
  39.     turtle.select(1)
  40.     turtle.place()
  41.     turtle.select(3)
  42.     turtle.place()
  43.     turtle.dig()
  44.     turtle.forward()
  45.     breakTree()
  46.     turtle.back()
  47.     os.sleep(120)
  48.     turtle.suck()
  49.     turtle.up()
  50.     deposit()
  51.    
  52.     if turtle.getItemCount(3) == 1 then
  53.         getMeal()
  54.     end
  55.        
  56.     turtle.down()
  57.    
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement