Willibilly19

2x2 Tall Tree

May 20th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. local lSide = "right"
  2. local height = 0
  3. local red = redstone.getInput(lSide)
  4.  
  5. local function forward()
  6. while not turtle.forward() do
  7. turtle.dig()
  8. turtle.attack()
  9. if turtle.getFuelLevel() < 1 then
  10. error("Out of Fuel!")
  11. end
  12. end
  13. end
  14.  
  15. local function plant()
  16. turtle.select(1)
  17. forward()
  18. forward()
  19. turtle.turnRight()
  20. turtle.place()
  21. turtle.turnLeft()
  22. turtle.back()
  23. turtle.place()
  24. turtle.turnRight()
  25. turtle.place()
  26. turtle.turnLeft()
  27. turtle.back()
  28. turtle.place()
  29. turtle.select(2)
  30. turtle.place()
  31. end
  32.  
  33. local function up()
  34. turtle.dig()
  35. while not turtle.up() do
  36. turtle.digUp()
  37. end
  38. turtle.dig()
  39. end
  40.  
  41. local function new()
  42. forward()
  43. turtle.turnRight()
  44. forward()
  45. turtle.turnRight()
  46. end
  47.  
  48. local function down()
  49. turtle.dig()
  50. while not turtle.down() do
  51. turtle.dig()
  52. turtle.digDown()
  53. end
  54. turtle.dig()
  55. end
  56.  
  57. local function reset()
  58. forward()
  59. forward()
  60. turtle.turnRight()
  61. forward()
  62. turtle.turnRight()
  63. end
  64.  
  65. if red then
  66. plant()
  67. turtle.dig()
  68. forward()
  69. repeat
  70. up()
  71. height = height + 1
  72. until not turtle.detectUp()
  73. new()
  74. repeat
  75. down()
  76. height = height - 1
  77. until height == 0
  78. reset()
  79. end
Advertisement
Add Comment
Please, Sign In to add comment