Advertisement
CrushDust

Mining turtle with chests

Nov 4th, 2023 (edited)
318
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 1 0
  1. --Save this program as startup
  2. --Also install the refuelling program at refuel
  3.  
  4. --Place the turtle in front of the
  5. --blocks you want it to start to strip mine.
  6. --Place chests in slot 16 and give it some
  7. --coal to start. It will mine 80 blocks
  8. --forward, turn to the right, and mine
  9. --80 blocks back. Because it mines 1x3
  10. --It will mine a total of 240 blocks.
  11.  
  12. --When it is done mining, it will move
  13. --to a new start position, turn around
  14. --place a chest and dump all its contents.
  15. --If there is enough fuel and more chests
  16. --the turtle will repeat indefinitely
  17.  
  18.  
  19. term.clear()
  20. term.setCursorPos(1,1)
  21.  
  22. print("Turtle is now powered on.")
  23. shell.run("refuel")
  24.  
  25. FL = turtle.getFuelLevel()
  26. turtle.select(16)
  27. sloot = turtle.getItemDetail()
  28. Chest = turtle.getItemCount()
  29.  
  30.  
  31. l=0
  32.  
  33. while l < 1 do
  34.  
  35. if FL > 500 and Chest > 0 and sloot.name == "minecraft:chest" then
  36.  
  37. function dig()
  38.     turtle.digUp()
  39.     turtle.digDown()
  40.     turtle.dig()
  41.     sleep(1)
  42.     block = turtle.detect()
  43.     while turtle.detect() == true do
  44.         turtle.dig()
  45.         sleep(1)
  46.         block = turtle.detect()
  47.     end
  48.     turtle.forward()
  49.    
  50. end
  51.  
  52.  
  53. i = 0
  54. while i < 80 do
  55.     dig()
  56.     i = i + 1
  57. end
  58.  
  59. shell.run("refuel")
  60. turtle.turnRight()
  61. dig()
  62. turtle.turnRight()
  63.  
  64. i = 0
  65. while i < 80 do
  66.     dig()
  67.     i = i + 1
  68. end
  69.  
  70. turtle.digUp()
  71. turtle.digDown()
  72. turtle.turnLeft()
  73. turtle.dig()
  74. turtle.forward()
  75. turtle.turnLeft()
  76. turtle.turnLeft()
  77. turtle.select(16)
  78. turtle.place()
  79. shell.run("refuel")
  80.  
  81. i = 1
  82. while i < 16 do
  83.     turtle.select(i)
  84.     turtle.drop(64)
  85.     i = i + 1
  86. end
  87.  
  88. turtle.turnRight()
  89. FL = turtle.getFuelLevel()
  90. turtle.select(16)
  91. Chest = turtle.getItemCount()
  92. sloot = turtle.getItemDetail()
  93.  
  94. if sloot == nil then
  95.     l=1
  96. end
  97.  
  98.  
  99. else
  100.  
  101. l=1
  102. end
  103. end
  104.  
  105. if FL < 500 then
  106.     print("Out of fuel, Shutting down")
  107. end
  108.  
  109. if Chest == 0 then
  110.     print(" Trutle has run out of chests, shutting down")
  111. end
  112.  
  113. print("Exiting")
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement