Second_Cup

Untitled

Jul 8th, 2025 (edited)
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. -- 2-Wide Vertical Shaft Digger (2 blocks wide, 1 block long)
  2. -- Digs entire 2-wide shaft first, then places ladders on left side while returning
  3. -- Slot 1: Ladders | Slot 2: Cobblestone (backing/lava protection)
  4.  
  5. function refuelIfNeeded(minFuel)
  6. if turtle.getFuelLevel() == "unlimited" then return true end
  7. while turtle.getFuelLevel() < minFuel do
  8. for i = 3, 16 do
  9. turtle.select(i)
  10. if turtle.refuel(1) then break end
  11. end
  12. if turtle.getFuelLevel() < minFuel then
  13. print("Add more fuel...")
  14. os.sleep(2)
  15. end
  16. end
  17. end
  18.  
  19. function digShaft(depth)
  20. for i = 1, depth do
  21. -- Dig right column (main position)
  22. while turtle.detectDown() do turtle.digDown() sleep(0.1) end
  23.  
  24. -- Move left and dig left column
  25. turtle.turnLeft()
  26. turtle.forward()
  27. while turtle.detectDown() do turtle.digDown() sleep(0.1) end
  28.  
  29. -- Descend both columns
  30. turtle.down() -- Left side
  31. turtle.back()
  32. turtle.turnRight()
  33. turtle.down() -- Right side
  34.  
  35. -- Check for lava and protect
  36. local success, data = turtle.inspectDown()
  37. if success and data.name == "minecraft:lava" then
  38. turtle.select(2)
  39. turtle.placeDown()
  40. end
  41. end
  42. end
  43.  
  44. function placeLadders(depth)
  45. -- Position turtle on left side at bottom
  46. turtle.turnLeft()
  47. turtle.forward()
  48.  
  49. for i = 1, depth do
  50. -- Ensure cobblestone backing exists
  51. if not turtle.inspect() then
  52. turtle.select(2)
  53. turtle.place() -- Place backing
  54. end
  55.  
  56. -- Place ladder from below
  57. turtle.select(1)
  58. turtle.placeDown()
  59.  
  60. -- Ascend to next level
  61. while not turtle.up() do
  62. turtle.digUp()
  63. sleep(0.1)
  64. end
  65. end
  66.  
  67. -- Return to right side and ascend to surface
  68. turtle.back()
  69. turtle.turnRight()
  70. for i = 1, depth do
  71. while not turtle.up() do
  72. turtle.digUp()
  73. sleep(0.1)
  74. end
  75. end
  76. end
  77.  
  78. -- === MAIN PROGRAM ===
  79. print("Enter shaft depth:")
  80. local depth = tonumber(read())
  81.  
  82. if not depth or depth < 1 then
  83. print("Invalid depth")
  84. return
  85. end
  86.  
  87. refuelIfNeeded(depth * 10 + 20) -- Extra fuel buffer
  88.  
  89. print("Digging 2-wide shaft...")
  90. digShaft(depth)
  91.  
  92. print("Placing ladders on left side...")
  93. placeLadders(depth)
  94.  
  95. print("✅ 2-wide ladder shaft complete!")
Advertisement
Add Comment
Please, Sign In to add comment