Advertisement
PhamKun

Spruce

Aug 8th, 2022 (edited)
841
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. function checkFuelLevel()
  2.     if turtle.getFuelLevel() == 0 then
  3.         turtle.select(16)
  4.         turtle.refuel()
  5.     end
  6. end
  7.  
  8. function placeSapling()
  9.     turtle.select(1)
  10.     checkFuelLevel()
  11.     turtle.select(1)
  12.     turtle.forward()
  13.     turtle.turnLeft()
  14.     turtle.place()
  15.     turtle.turnRight()
  16.     checkFuelLevel()
  17.     turtle.select(1)
  18.     turtle.forward()
  19.     turtle.turnLeft()
  20.     turtle.place()
  21.     turtle.turnRight()
  22.     checkFuelLevel()
  23.     turtle.select(1)
  24.     turtle.back()
  25.     turtle.place()
  26.     checkFuelLevel()
  27.     turtle.select(1)
  28.     turtle.back()
  29.     turtle.place()
  30.     for i=1, 7 ,1 do
  31.         checkFuelLevel()
  32.         turtle.back()
  33.     end
  34. end
  35.  
  36. function chopUp()
  37.     turtle.select(15)
  38.     while turtle.detectUp() do
  39.         turtle.digUp()
  40.         checkFuelLevel()
  41.         turtle.select(15)
  42.         turtle.up()
  43.     end
  44. end
  45.  
  46. function chopDown()
  47.     turtle.select(14)
  48.     while turtle.compareDown() == false do
  49.         turtle.digDown()
  50.         checkFuelLevel()
  51.         turtle.select(14)
  52.         turtle.down()
  53.     end
  54. end
  55.  
  56. function checkGrowth()
  57.     for i=1, 7 ,1 do
  58.         checkFuelLevel()
  59.         if turtle.forward() == false then
  60.             turtle.dig()
  61.             turtle.forward()
  62.         end
  63.         turtle.select(15)
  64.         if turtle.compare() then
  65.             return true
  66.         end
  67.     end
  68.  
  69.     for i=1, 7 ,1 do
  70.         checkFuelLevel()
  71.         turtle.back()
  72.     end
  73.     sleep(30)
  74. end
  75.  
  76.  
  77.  
  78. --main
  79. placeSapling()
  80. while true do
  81.     turtle.select(15)
  82.     if checkGrowth() then
  83.         turtle.dig()
  84.         checkFuelLevel()
  85.         turtle.forward()
  86.         chopUp()
  87.         checkFuelLevel()
  88.         if turtle.forward() == false then
  89.             turtle.dig()
  90.             turtle.forward()
  91.         end
  92.         chopDown()
  93.         turtle.turnLeft()
  94.         turtle.dig()
  95.         checkFuelLevel()
  96.         turtle.forward()
  97.         turtle.turnLeft()
  98.         chopUp()
  99.         checkFuelLevel()
  100.         if turtle.forward() == false then
  101.             turtle.dig()
  102.             turtle.forward()
  103.         end
  104.         chopDown()
  105.         turtle.turnLeft()
  106.         turtle.forward()
  107.         turtle.turnLeft()
  108.         turtle.back()
  109.         placeSapling()
  110.     end
  111.  
  112. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement