Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1.  
  2. -- http://computercraft.info/wiki/Turtle_(API)
  3.  
  4. treeHeight = 6
  5. t = turtle
  6.  
  7. digTree = function() -- main dig tree function
  8. t.dig()
  9. t.forward()
  10. for i = 1, treeHeight - 1, 1 do
  11. t.digUp()
  12. t.up()
  13. end
  14. for i = 1, treeHeight - 1, 1 do
  15. t.down()
  16. end
  17. t.back()
  18. return true
  19. end
  20.  
  21. dumpItems = function() -- dumps all items directly downwards
  22. t.refuel(2)
  23. for i = 16, 1, -1 do
  24. t.select(i)
  25. t.dropDown()
  26. end
  27. return true
  28. end
  29.  
  30. detectTree = function()
  31. local success, data = t.inspect()
  32. if success and data.name == "minecraft:log" then
  33. return true
  34. end
  35. end
  36.  
  37. plantTree = function()
  38. t.back()
  39. t.back()
  40. t.down()
  41. t.suckDown(1)
  42. t.up()
  43. t.forward()
  44. t.forward()
  45. t.place()
  46. end
  47.  
  48.  
  49. while true do -- MAIN LOOP
  50.  
  51. if detectTree() then
  52. print("I FOUND A TREE, BABY!")
  53. digTree()
  54. dumpItems()
  55. plantTree()
  56. end
  57. print("LOOP")
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement