Advertisement
MatthewJ217

mine_this_block (CC Turte)

Jul 5th, 2024
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local _,target = turtle.inspect()
  2.  
  3. function isFiller(block)
  4.     return not (block.name == target.name);
  5. end
  6.  
  7. function checkBlock(direction)
  8.     if direction == 0 then
  9.         local isBlock, block = turtle.inspectDown();
  10.         if isBlock and not isFiller(block) then
  11.             turtle.digDown()
  12.             turtle.down()
  13.             search()
  14.             turtle.up()
  15.         end
  16.     elseif direction == 1 then
  17.         local isBlock, block = turtle.inspect();
  18.         if isBlock and not isFiller(block) then
  19.             while not turtle.forward() do turtle.dig() end
  20.             search()
  21.             turtle.back()
  22.         end
  23.     elseif direction == 2 then
  24.         local isBlock, block = turtle.inspectUp();
  25.         if isBlock and not isFiller(block) then
  26.             turtle.digUp()
  27.             turtle.up()
  28.             search()
  29.             turtle.down()
  30.         end
  31.     end
  32. end
  33.  
  34. function search()
  35.     checkBlock(2)
  36.     checkBlock(1)
  37.     turtle.turnLeft()
  38.     checkBlock(1)
  39.     turtle.turnLeft()
  40.     checkBlock(1)
  41.     turtle.turnLeft()
  42.     checkBlock(1)
  43.     turtle.turnLeft()
  44.     checkBlock(0)
  45. end
  46.  
  47. search()
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement