CodeCrow

Obsidiminer

Jun 4th, 2022
1,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. -- Place down and detect block below
  2.  
  3. TR = true
  4. TL = false
  5. check_one = false
  6. check_two = false
  7.  
  8. -- Detect block below
  9. success, data = turtle.inspectDown()
  10.  
  11. while success do
  12. -- If block is obsidian break and move forward
  13.     if data.name == "minecraft:obsidian" then
  14.         turtle.digDown()
  15.         turtle.forward()
  16.         check_one = false
  17.         check_two = false
  18.     else
  19.         turtle.back()
  20.         check_one = true
  21. -- If not obsidian, turn right and search for obsidian
  22.         if TR then
  23.             turtle.turnRight()
  24.             turtle.forward()
  25.             turtle.turnRight()
  26.             TR = false
  27.             TL = true
  28. -- If not obsidian, turn left and search for obsidian
  29.         elseif TL then
  30.             turtle.turnLeft()
  31.             turtle.forward()
  32.             turtle.turnLeft()
  33.             TR = true
  34.             TL = false
  35.         end
  36.        
  37.         success, data = turtle.inspectDown()
  38.         if success and data.name ~= "minecraft:obsidian" then
  39.             check_two = true
  40.         end
  41.        
  42.         if check_one and check_two then
  43.             turtle.down()
  44.             turtle.turnRight()
  45.             turtle.turnRight()
  46.             if TR then
  47.                 TR = false
  48.                 TL = true
  49.             elseif TL then
  50.                 TR = true
  51.                 TL = false
  52.             end
  53.         end
  54.     end
  55.     success, data = turtle.inspectDown()
  56.     if success ~= true then
  57.         break
  58.     end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment