Advertisement
Guest User

Tree Turtle v1.0

a guest
Jun 16th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. function fuelCheck()
  2. local fuelLevel = turtle.getFuelLevel()
  3. if fuelLevel < 20 then
  4. turtle.select(1)
  5. turtle.refuel(1)
  6. print("Refueled.")
  7. end
  8. end
  9.  
  10.  
  11. function chopTree()
  12. local success, data = turtle.inspect()
  13. if data.name == "minecraft:log" then
  14. print("Tree detected... chopping.")
  15. turtle.dig()
  16. turtle.suck()
  17. turtle.suckUp()
  18. turtle.forward()
  19. turtle.suck()
  20. while turtle.detect() == true do
  21. turtle.digUp()
  22. turtle.up()
  23. end
  24. while turtle.detectDown() == false do
  25. turtle.down()
  26. end
  27. turtle.suck()
  28. turtle.back()
  29. turtle.suck()
  30. turtle.select(3)
  31. turtle.place()
  32. turtle.select(1)
  33. end
  34. end
  35.  
  36. local chopping = true
  37. while chopping do
  38. fuelCheck()
  39. chopTree()
  40. turtle.suck()
  41. turtle.suckUp()
  42. turtle.turnLeft()
  43. turtle.suck()
  44. turtle.turnRight()
  45. turtle.turnRight()
  46. turtle.suck()
  47. turtle.turnRight()
  48. for i = 1, 16 do
  49. if i > 3 then
  50. if turtle.getItemCount(i) > 0 then
  51. turtle.select(i)
  52. turtle.drop()
  53. end
  54. end
  55. end
  56. turtle.turnLeft()
  57. turtle.turnLeft()
  58. turtle.select(1)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement