Sir_Popsilots

Bridge And Tunnel Turtle

Jan 7th, 2026
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. local Length = ...
  2. if Length ~= nil then
  3.     Length = tonumber(Length)
  4. else
  5.     print("enter Dig Length")
  6.     Length = tonumber(io.read())
  7. end
  8. if Length == nil or Length < 0 then
  9.     print("INVALID NUMBER")
  10.     Length = false
  11. end
  12.  
  13. local bannedBlocks = "yes"
  14.  
  15. function findBlock()
  16.     for i=1,16,1 do
  17.         turtle.select(i)
  18.         if turtle.getItemCount() > 0 and turtle.getItemDetail(i).name ~= "minecraft:gravel" then
  19.             return i
  20.         end
  21.     end
  22.     return false
  23.    
  24. end
  25.  
  26. if Length ~= false then
  27.     while Length > 0 do
  28.         if Length % 15 == 0 then
  29.             print(Length," left to Bridge")
  30.         end
  31.         if turtle.detectDown() then
  32.             if turtle.detectUp() then turtle.digUp() end
  33.             if turtle.detect() then turtle.dig() end
  34.             turtle.forward()
  35.             Length = Length - 1
  36.         else
  37.             if turtle.getItemCount() > 0 then
  38.                 if not turtle.placeDown() then
  39.                     turtle.dropUp()
  40.                 end
  41.             else
  42.                 local Slot = findBlock()
  43.                 if Slot ~= false then
  44.                     turtle.select(Slot)
  45.                 else
  46.                     break
  47.                 end
  48.             end
  49.         end    
  50.     end
  51. end
  52.  
  53. if findBlock() then
  54.     print("done")
  55. else
  56.     print("out of blocks")
  57. end
  58. turtle.select(1)
  59.              
  60.  
Add Comment
Please, Sign In to add comment