InsideIntel

Untitled

Jan 14th, 2024 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. -- Set the size of the area to be mined
  2. local width = 9
  3. local height = 9
  4.  
  5. -- Function to mine forward and handle fuel
  6. function mineForward()
  7. while not turtle.forward() do
  8. if turtle.getFuelLevel() == 0 then
  9. print("Out of fuel. Refuel and restart.")
  10. error()
  11. end
  12. turtle.refuel(1)
  13. end
  14. end
  15.  
  16. -- Function to mine a full column
  17. function mineColumn()
  18. for i = 1, height do
  19. turtle.digDown()
  20. mineForward()
  21. end
  22. end
  23.  
  24. -- Function to move to the next column
  25. function moveToNextColumn()
  26. if turtle.getFuelLevel() == 0 then
  27. print("Out of fuel. Refuel and restart.")
  28. error()
  29. end
  30.  
  31. turtle.turnRight()
  32. turtle.digDown()
  33. mineForward()
  34. turtle.turnRight()
  35. end
  36.  
  37. -- Main mining function
  38. function mineArea()
  39. for col = 1, width do
  40. mineColumn()
  41. if col < width then
  42. moveToNextColumn()
  43. end
  44. end
  45. end
  46.  
  47. -- Function to move to the next level
  48. function moveToNextLevel()
  49. turtle.digDown()
  50. turtle.down()
  51. end
  52.  
  53. -- Main mining process
  54. for level = 1, height do
  55. mineArea()
  56.  
  57. if level < height then
  58. moveToNextLevel()
  59. end
  60. end
  61.  
Advertisement
Add Comment
Please, Sign In to add comment