Advertisement
aharries

digdown

Apr 17th, 2024 (edited)
632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local depth = 0
  2.  
  3. while true do
  4.     -- Check if the block below is bedrock
  5.     local success, data = turtle.inspectDown()
  6.     if not success or data.name == "minecraft:bedrock" then
  7.         print("Bedrock or void detected, stopping.")
  8.         break  -- Stop if bedrock or void is encountered
  9.     end
  10.    
  11.     -- Ensure there's enough fuel
  12.     if turtle.getFuelLevel() == 0 then
  13.         print("Out of fuel")
  14.         break
  15.     end
  16.    
  17.     -- Dig down and move
  18.     turtle.digDown()
  19.     turtle.down()
  20.     depth = depth + 1  -- Count how many times it moves down
  21. end
  22.  
  23. -- Return to surface
  24. while depth > 0 do
  25.     turtle.up()
  26.     depth = depth - 1
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement