Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. --Turtles do not always detect their tools upon reloading the turtle
  2. --unequiping and equiping the tools fixes this
  3.  
  4. turtle.select(15)
  5. turtle.equipLeft()
  6. turtle.equipLeft()
  7. turtle.select(1)
  8.  
  9.  
  10. print("Please put a lava source to the right of the Turtle.")
  11. print("Put a lava bucket in the last slot (bottom right).")
  12. print("")
  13. print("How long is the farm?")
  14. length = read()
  15.  
  16.  
  17. function fuelCheck()
  18. print("Fuel check ran")
  19. fuel = turtle.getFuelLevel()
  20. while fuel < 4000 do
  21. turtle.turnRight()
  22. turtle.select(16)
  23. turtle.place()
  24. turtle.refuel()
  25. turtle.turnLeft()
  26. end
  27. end
  28.  
  29. function farm()
  30. for i=1,length do
  31. turtle.dig()
  32. turtle.forward()
  33. turtle.digDown()
  34. end
  35. end
  36.  
  37. function detectBlock()
  38.  
  39. --Wait for farm to grow
  40. noBlock = true
  41. while noBlock do
  42. if noBlock == turtle.detect() then
  43. return false
  44. else
  45. return true
  46. end
  47. end
  48. end
  49.  
  50.  
  51. while true do
  52. if detectBlock() then
  53.  
  54. --Check fuel before mining
  55. fuelCheck()
  56.  
  57. farm()
  58. --Go to lane to the left
  59.  
  60. turtle.turnLeft()
  61. turtle.forward(2)
  62. turtle.turnLeft()
  63.  
  64. --Farm next lane
  65.  
  66. farm()
  67.  
  68. --Go back to starting position
  69.  
  70. turtle.turnLeft()
  71. turtle.forward(2)
  72. turtle.turnLeft()
  73.  
  74. --Reset detectBlock to restart system
  75. detectBlock = false
  76. else
  77. sleep(60)
  78. end
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement