Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. inp = 0
  2. local main = 1
  3. if turtle.getItemCount(16) == 0 then
  4. print("No chest in slot 16")
  5. else
  6. print("Chest detected")
  7. chest = turtle.getItemDetail(16)["name"]
  8. end
  9. local function aboutface()
  10. turtle.turnLeft()
  11. turtle.turnLeft()
  12. end
  13.  
  14. local function placetorch(fag)
  15. if turtle.getItemCount(fag) > 0 then
  16. turtle.select(fag)
  17. turtle.placeDown()
  18. turtle.select(1)
  19. else
  20. print("No torches")
  21. end
  22. end
  23.  
  24.  
  25.  
  26. local function itemdump(iter)
  27. if turtle.getItemCount(14) > 0 or main == 0 then
  28. turtle.back()
  29. if (iter%2) == 1 then
  30. turtle.turnRight()
  31. else
  32. turtle.turnLeft()
  33. end
  34. local b, t =turtle.inspectDown()
  35. while t.name ~= chest do
  36. if t.name ~= chest then
  37. turtle.forward()
  38. end
  39. b,t = turtle.inspectDown()
  40. end
  41. for x=1,14 do
  42. turtle.select(x)
  43. turtle.dropDown()
  44. end
  45. turtle.select(1)
  46. if main > 0 then
  47. aboutface()
  48. while turtle.inspect() == false do
  49. turtle.forward()
  50. end
  51. firstiter(iter)
  52. end
  53. end
  54. end
  55. local function digcheck()
  56. if turtle.inspect() then
  57. turtle.dig()
  58. digcheck()
  59. else
  60. turtle.forward()
  61. end
  62. end
  63.  
  64. local function dig()
  65. digcheck()
  66. turtle.digUp()
  67. turtle.digDown()
  68. end
  69.  
  70. local function FirstIter(iter)
  71. turtle.up()
  72. if iter == 1 then
  73. placetorch(16)
  74. end
  75. dig()
  76. turtle.turnRight()
  77. dig()
  78. end
  79.  
  80. local function digwall(iter)
  81. if iter == 1 then
  82. FirstIter(iter)
  83. else
  84. if (iter%2) == 0 then
  85. turtle.turnLeft()
  86. dig()
  87. turtle.turnLeft()
  88. for x = 1,2 do
  89. dig()
  90. end
  91. else
  92. turtle.turnRight()
  93. dig()
  94. turtle.turnRight()
  95. for x = 1,2 do
  96. dig()
  97. end
  98. end
  99. end
  100. end
  101.  
  102. inp = io.read()
  103. for x = 1,inp do
  104. digwall(x)
  105. print(x)
  106. if (x%7) == 0 then
  107. placetorch(15)
  108. end
  109. itemdump(x)
  110. end
  111. main = 0
  112. itemdump(x)
  113. print("Mining done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement