Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 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. if success==true then
  15. print("block gefunden!")
  16. else
  17. print("kein block gefunden")
  18. end
  19.  
  20. if mode==1 then
  21. if dir == 0 then --up
  22. turtle.digUp()
  23. elseif dir==1 then --foward
  24. print("buddle nach vorne")
  25. turtle.dig()
  26. else --do
  27. turtle.digDown()
  28. end
  29. end
  30.  
  31. if success then
  32. if data.name == "minecraft:stone" then --Found Ore
  33. print("I found stone!")
  34. if mode==1 then
  35. if dir == 0 then --up
  36. turtle.digUp()
  37. elseif dir==1 then --foward
  38. turtle.dig()
  39. else --down
  40. turtle.digDown()
  41. end
  42. end
  43.  
  44. if dir == 0 then --up
  45. turtle.up()
  46. elseif dir==1 then --foward
  47. turtle.forward()
  48. else --down
  49. turtle.down()
  50. end
  51.  
  52. mine(1,0)
  53. turtle.turnLeft()
  54. mine(1,0)
  55. turtle.turnRight()
  56. turtle.turnRight()
  57. mine(1,0)
  58. turtle.turnLeft()
  59.  
  60. mine(0,0)
  61. mine(2,0)
  62.  
  63. if dir == 0 then --up
  64. turtle.down()
  65. elseif dir==1 then --foward
  66. turtle.back()
  67. else --down
  68. turtle.up()
  69. end
  70. end
  71. end
  72. end
  73.  
  74.  
  75.  
  76.  
  77. mine(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement