Advertisement
huggle

Untitled

Oct 17th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. function clearTree()
  2. print("attempting to clear a tree")
  3. turtle.dig()
  4. turtle.forward()
  5. local cleared = false
  6. local tempHeight = 0
  7. repeat
  8. local tempBlock, n = turtle.inspectUp()
  9. if tempBlock then
  10. if n.name == "minecraft:log" then
  11. turtle.digUp()
  12. turtle.up()
  13. tempHeight = tempHeight + 1
  14. else
  15. cleared = true
  16. end
  17. else
  18. cleared = true
  19. end
  20. until(cleared == true)
  21. repeat
  22. turtle.down()
  23. tempHeight = tempHeight - 1
  24. until (tempHeight == 0)
  25. turtle.back()
  26. print("successfully cleared a tree!")
  27. print("planting a sapling")
  28. turtle.select(1)
  29. turtle.place()
  30. print("planted a sapling!")
  31. end
  32.  
  33. function nextTreeInRow()
  34. print("attempting to go to the next tree in row")
  35. turtle.turnLeft()
  36. turtle.forward()
  37. turtle.forward()
  38. turtle.forward()
  39. turtle.forward()
  40. turtle.turnRight()
  41. print("successfully went to the next tree in row!")
  42. end
  43.  
  44. function goToNextRow()
  45. print ("attempting to go to the next row")
  46. turtle.turnRight()
  47. turtle.forward()
  48. turtle.turnLeft()
  49. turtle.forward()
  50. turtle.forward()
  51. turtle.forward()
  52. turtle.forward()
  53. turtle.turnLeft()
  54. turtle.forward()
  55. turtle.turnRight()
  56. print (" successfully went to the next row")
  57. end
  58.  
  59. function returnToStart()
  60. print("attempting to go to the start of the trees")
  61. turtle.turnRight()
  62. turtle.forward()
  63. turtle.turnRight()
  64. for i = 0, 15, 1
  65. do
  66. turtle.forward()
  67. end
  68. turtle.turnRight()
  69. turtle.forward()
  70. turtle.turnRight()
  71. print("sucessfully returned to the start")
  72. end
  73.  
  74. function startOfRow()
  75. turtle.turnRight()
  76. for i = 0, 11, 1
  77. do
  78. turtle.forward()
  79. end
  80. turtle.turnLeft()
  81. end
  82.  
  83. local length = 4
  84. local width = 5
  85.  
  86. for w = 1, width-1, 1
  87. do
  88. local tempa, x = turtle.inspect()
  89. if tempa then
  90. if x.name == "minecraft:log" then
  91. clearTree()
  92. end
  93. end
  94. for l = 1, length-1, 1
  95. do
  96. nextTreeInRow()
  97. local temp, x = turtle.inspect()
  98. if temp then
  99. if x.name == "minecraft:log" then
  100. clearTree()
  101. end
  102. end
  103. end
  104. startOfRow()
  105. goToNextRow()
  106. end
  107. returnToStart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement