Advertisement
huggle

Untitled

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