Advertisement
MatthewJ217

Simple vein miner (CC Turtle)

Dec 3rd, 2022 (edited)
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. function isFiller(block)
  2.     return block.name == "minecraft:diorite" or block.name == "minecraft:deepslate" or block.name == "minecraft:stone" or block.name == "minecraft:granite" or block.name == "minecraft:cob blestone" or block.name == "minecraft:cobbled_deepslate" or block.name == "minecraft:netherrack" or block.name == "minecraft:grass_block" or block.name == "minecraft:dirt" or block.name == "minecraft:water" or block.name == "minecraft:lava" or block.name == "minecraft:sand" or block.name == "minecraft:farmland" or block.name == "minecraft:chest" or block.name == "minecraft:shulker_box"
  3. end
  4.  
  5. function checkBlock(direction)
  6.     if direction == 0 then
  7.         local isBlock, block = turtle.inspectDown();
  8.         if isBlock and not isFiller(block) then
  9.             turtle.digDown()
  10.             turtle.down()
  11.             search()
  12.             turtle.up()
  13.         end
  14.     elseif direction == 1 then
  15.         local isBlock, block = turtle.inspect();
  16.         if isBlock and not isFiller(block) then
  17.             turtle.dig()
  18.             turtle.forward()
  19.             search()
  20.             turtle.back()
  21.         end
  22.     elseif direction == 2 then
  23.         local isBlock, block = turtle.inspectUp();
  24.         if isBlock and not isFiller(block) then
  25.             turtle.digUp()
  26.             turtle.up()
  27.             search()
  28.             turtle.down()
  29.         end
  30.     end
  31. end
  32.  
  33. function search()
  34.     checkBlock(2)
  35.     checkBlock(1)
  36.     turtle.turnLeft()
  37.     checkBlock(1)
  38.     turtle.turnLeft()
  39.     checkBlock(1)
  40.     turtle.turnLeft()
  41.     checkBlock(1)
  42.     turtle.turnLeft()
  43.     checkBlock(0)
  44. end
  45.  
  46. search()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement