Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. local function mine(dir,mode) --mode: 1(normal) 0(ore-only) |dir: 0(d) 1(f) 2(u)
  2.  
  3. print("direction:" .. dir .. " / mode: " .. mode)
  4.  
  5. local success, data
  6. if dir == 0 then --up
  7. success, data = turtle.inspectUp()
  8. elseif dir==1 then --foward
  9. success, data = turtle.inspect()
  10. else --down
  11. success, data = turtle.inspectDown()
  12. end
  13.  
  14. print("found block:" .. success)
  15.  
  16. if mode==1 then
  17. if dir == 0 then --up
  18. turtle.digUp()
  19. elseif dir==1 then --foward
  20. turtle.dig()
  21. else --do
  22. turtle.digDown()
  23. end
  24. end
  25.  
  26. if success then
  27. if data.name == "minecraft:stone" then --Found Ore
  28. print("I found stone!")
  29. if mode==1 then
  30. if dir == 0 then --up
  31. turtle.digUp()
  32. elseif dir==1 then --foward
  33. turtle.dig()
  34. else --down
  35. turtle.digDown()
  36. end
  37. end
  38.  
  39. if dir == 0 then --up
  40. turtle.up()
  41. elseif dir==1 then --foward
  42. turtle.forward()
  43. else --down
  44. turtle.down()
  45. end
  46.  
  47. mine(1,0)
  48. turtle.turnLeft()
  49. mine(1,0)
  50. turtle.turnRight()
  51. turtle.turnRight()
  52. mine(1,0)
  53. turtle.turnLeft()
  54.  
  55. mine(0,0)
  56. mine(2,0)
  57.  
  58. if dir == 0 then --up
  59. turtle.down()
  60. elseif dir==1 then --foward
  61. turtle.back()
  62. else --down
  63. turtle.up()
  64. end
  65. end
  66. end
  67. end
  68.  
  69.  
  70.  
  71.  
  72. mine(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement