Advertisement
Lolomanolo57

Untitled

Feb 8th, 2025 (edited)
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. local facing = true
  2.  
  3. function is_at_bedrock()
  4. local block_exists, block_data = turtle.inspectDown()
  5. if block_exists and block_data.name == 'minecraft:bedrock' then
  6. return true
  7. else
  8. return false
  9. end
  10. end
  11.  
  12. function is_facing_bedrock()
  13. local block_exists, block_data = turtle.inspect()
  14. if block_exists and block_data.name == 'minecraft:bedrock' then
  15. return true
  16. else
  17. return false
  18. end
  19. end
  20.  
  21. function refuel_and_move()
  22. if turtle.getFuelLevel() <= 0 and not turtle.refuel() then
  23. print('Out of fuel! :(')
  24. return false
  25. else
  26. return turtle.forward()
  27. end
  28. end
  29.  
  30. while true do
  31. for i=0,15 do
  32. for j=0,15 do
  33. if is_at_bedrock() then
  34. return
  35. end
  36. turtle.digDown()
  37.  
  38. if is_facing_bedrock() then
  39. return
  40. end
  41. turtle.dig()
  42.  
  43. if not refuel_and_move() then
  44. return
  45. end
  46. end
  47.  
  48. if i==15 and j==15 then
  49. turtle.turnRight()
  50. turtle.turnRight()
  51. facing = false
  52. elseif facing then
  53. turtle.turnRight()
  54. if is_facing_bedrock() then
  55. return
  56. else
  57. turtle.dig()
  58. end
  59. if not refuel_and_move() then
  60. return
  61. end
  62. turtle.turnRight()
  63. else
  64. turtle.turnLeft()
  65. if is_facing_bedrock() then
  66. return
  67. else
  68. turtle.dig()
  69. end
  70. if not refuel_and_move() then
  71. return
  72. end
  73. turtle.turnLeft()
  74. end
  75. facing = not facing
  76. end
  77.  
  78. turtle.down()
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement