Guest User

Turtle Tree Farm

a guest
Mar 30th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. print( "Put some barrels/chests in Slot 1..." )
  2. print( "...a stack of Oak Saplings in Slot 2" )
  3. print( "...a Hoe of Growth/Bonemeal in slot 3")
  4. print( "Press any key to continue..." )
  5. os.pullEvent("char")
  6.  
  7. local lvl = 1
  8.  
  9. turtle.digDown()
  10. turtle.select(1)
  11. turtle.placeDown()
  12.  
  13. local function ascend()
  14. turtle.up()
  15. local lvl = lvl + 1
  16. end
  17. local function descend()
  18. turtle.down()
  19. local lvl = lvl - 1
  20. end
  21. local function grow()
  22. turtle.select(2)
  23. turtle.place()
  24. turtle.select(3)
  25. turtle.place()
  26. ascend()
  27. end
  28. local function chop()
  29. turtle.select(4)
  30. turtle.dig()
  31. turtle.forward()
  32. while turtle.detectUp() = true do
  33. turtle.digUp()
  34. ascend()
  35. end
  36. while lvl > 1 do
  37. while turtle.detectdown() = true do
  38. turtle.digDown()
  39. end
  40. while turtle.detectdown() = false do
  41. descend()
  42. end
  43. end
  44. turtle.back()
  45. end
  46. local function unload()
  47. for i = 3, 16 do
  48. turtle.select(i)
  49. turtle.dropDown()
  50. end
  51. end
  52.  
  53. for t = 1, 64 do
  54. grow()
  55. chop()
  56. unload()
  57. end
Advertisement
Add Comment
Please, Sign In to add comment