Advertisement
visiongaming43

Untitled

Sep 29th, 2021
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. -- Will make the turtle automatically place and mine a tree
  2.  
  3. -- Gets fuel level
  4. local fuelLevel = turtle.getFuelLevel()
  5.  
  6. -- If fuel level is greater than 30, then run the code
  7. if (fuelLevel > 30) then
  8. local isBlock, data = turtle.inspect()
  9.  
  10. while(isBlock == false) do
  11. turtle.turnRight()
  12. turtle.turnRight()
  13. for count = 4, 1, -1 do
  14. turtle.forward()
  15. end
  16. turtle.down()
  17. turtle.down()
  18. turtle.suckDown()
  19. turtle.up()
  20. turtle.up()
  21. turtle.turnLeft()
  22. turtle.turnLeft()
  23. for count = 4, 1, -1 do
  24. turtle.forward()
  25. end
  26. turtle.place()
  27. isBlock, data = turtle.inspect()
  28. end
  29.  
  30. while(isBlock and string.match(data.name, "sapling")) do
  31. isBlock, data = turtle.inspect()
  32. end
  33.  
  34. if(isBlock and string.match(data.name, "log")) then
  35. turtle.dig()
  36. turtle.forward()
  37. local isBlockUp, dataUp = turtle.inspectUp()
  38. local counter = 0
  39. while(string.match(dataUp.name, "log")) do
  40. turtle.digUp()
  41. turtle.up()
  42. counter = counter + 1
  43. isBlockUp, dataUp = turtle.inspectUp()
  44. end
  45. for count = counter, 1, -1 do
  46. turtle.down()
  47. end
  48. turtle.turnRight()
  49. turtle.turnRight()
  50. turtle.forward()
  51. turtle.turnLeft()
  52. turtle.turnLeft()
  53.  
  54. local timerID = os.startTimer(1)
  55. local event, id
  56. repeat
  57. event, id = os.pullEvent("timer")
  58. until id == timerID
  59. os.reboot()
  60. end
  61. else
  62. print("Not enough fuel bro :(")
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement