clumsyfunk

TreeFram

Feb 16th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local numSapling = 0
  2. local saplingSlot = 15
  3. local fuelSlot = 16
  4. local success, tree = turtle.inspect()
  5.  
  6.  
  7. function checkFuel()
  8.     if turtle.getFuelLevel() < 80 then
  9.         turtle.select(fuelSlot)
  10.         turtle.refuel(1)
  11.         turtle.select(1)
  12.     end
  13. end
  14.  
  15. function plantSapling()
  16.     turtle.select(saplingSlot)
  17.     turtle.place()
  18.     turtle.select(1)
  19. end
  20.  
  21. function dance()
  22.     turtle.turnLeft()
  23.     turtle.turnRight()
  24.     turtle.turnLeft()
  25.     turtle.turnRight()
  26.     turtle.turnLeft()
  27.     turtle.turnRight()
  28. end
  29.  
  30. function checkTree()
  31.     while tree.name == "minecraft:birch_sapling" do
  32.         turtle.turnLeft()
  33.       success, tree = turtle.inspect()
  34.     end
  35.     cutTree()
  36. end
  37.  
  38. function cutTree()
  39.     turtle.dig()
  40.     turtle.forward()
  41.     while turtle.inspectUp() == true do
  42.         turtle.digUp()
  43.         turtle.up()
  44.     end
  45.     while turtle.inspectDown() == false do
  46.         turtle.down()
  47.     end
  48.     turtle.back()
  49.     plantSapling()
  50.     success, tree = turtle.inspect()
  51. end
  52.  
  53. function countSaplings()
  54.     numSapling = turtle.getItemCount(saplingSlot)
  55. end
  56.  
  57. function turtleStart()
  58.     countSaplings()
  59.     for i = 1, numSapling do
  60.         checkFuel()
  61.         checkTree()
  62.     end
  63. end
  64.  
  65. turtleStart()
Add Comment
Please, Sign In to add comment