Advertisement
Robear9992

shaft

Nov 20th, 2023 (edited)
1,213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. --cc:Tweaked: Passage
  2. --pastebin get jE59aCsf shaft.lua
  3. --shaft
  4.  
  5. local nav =     require("navigation")
  6. local inv =     require("inventory")
  7. local timer =   require("timer")
  8. local sides =   require("sides")
  9.  
  10. local COBBLE =      { name = "minecraft:cobblestone" }
  11. local BEDROCK =     { name = "minecraft:bedrock" }
  12.  
  13. function place(item)
  14.     if not turtle.items.select(item) then return false end
  15.     if not turtle.detect() then turtle.place() end
  16.     return true
  17. end
  18.  
  19. local function atBedrock()
  20.     local blocked, item = turtle.inspectDown()
  21.     if not blocked then return false end
  22.     return stacksEqual(item, BEDROCK)
  23. end
  24.  
  25. ---- Main Loop
  26. timer.start()
  27. local depth = 0
  28.  
  29. while not atBedrock() do
  30.     nav.down()
  31.     place(COBBLE)
  32.     depth = depth + 1
  33. end
  34.  
  35. turtle.turnLeft()
  36. for n=1,depth do
  37.     nav.up()
  38.     place(COBBLE)
  39. end
  40.  
  41. turtle.turnLeft()
  42. for n=1,depth do
  43.     nav.down()
  44.     place(COBBLE)
  45. end
  46.  
  47. turtle.turnLeft()
  48. for n=1,depth do
  49.     nav.up()
  50.     place(COBBLE)
  51. end
  52.  
  53. turtle.turnLeft()
  54. nav.moveHome()  --API can be wonky sometimes and not move properly. Ensure we actually made it home.
  55.  
  56. print("Completed in "..timer.format())
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement