Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
129
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
  30. turtle.turnRight()
  31. else
  32. turtle.turnLeft()
  33. end
  34. end
  35. local b, t =turtle.inspectDown()
  36. while t.name ~= chest do
  37. if t.name ~= chest then
  38. turtle.forward()
  39. end
  40. b,t = turtle.inspectDown()
  41. end
  42. for x=1,14 do
  43. turtle.select(x)
  44. turtle.dropDown()
  45. end
  46. turtle.select(1)
  47. if main > 0 then
  48. aboutface()
  49. while turtle.inspect() == false do
  50. turtle.forward()
  51. end
  52. firstiter(iter)
  53. end
  54. end
  55. end
  56. local function digcheck()
  57. if turtle.inspect() then
  58. turtle.dig()
  59. digcheck()
  60. else
  61. turtle.forward()
  62. end
  63. end
  64.  
  65. local function dig()
  66. digcheck()
  67. turtle.digUp()
  68. turtle.digDown()
  69. end
  70.  
  71. local function FirstIter(iter)
  72. turtle.up()
  73. if iter == 1 then
  74. placetorch(16)
  75. end
  76. dig()
  77. turtle.turnRight()
  78. dig()
  79. end
  80.  
  81. local function digwall(iter)
  82. if iter == 1 then
  83. FirstIter(iter)
  84. else
  85. if (iter%2) == 0 then
  86. turtle.turnLeft()
  87. dig()
  88. turtle.turnLeft()
  89. for x = 1,2 do
  90. dig()
  91. end
  92. else
  93. turtle.turnRight()
  94. dig()
  95. turtle.turnRight()
  96. for x = 1,2 do
  97. dig()
  98. end
  99. end
  100. end
  101. end
  102.  
  103. inp = io.read()
  104. for x = 1,inp do
  105. digwall(x)
  106. print(x)
  107. if (x%7) == 0 then
  108. placetorch(15)
  109. end
  110. itemdump(x)
  111. end
  112. main = 0
  113. itemdump(x)
  114. print("Mining done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement