Advertisement
jhughey99

Untitled

Oct 6th, 2022
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. cl = 1
  2.  
  3. write("Forward:")
  4.  
  5. local f = tonumber(read())
  6.  
  7.  
  8. write("Right:")
  9.  
  10. local r = tonumber(read())
  11.  
  12.  
  13. write("Up:")
  14.  
  15. local u = tonumber(read())
  16.  
  17. function dig()
  18. while turtle.detect() == true do
  19. turtle.dig()
  20. end
  21. end
  22.  
  23. function digUp()
  24. while turtle.detectUp() == true do
  25. turtle.digUp()
  26. end
  27. end
  28.  
  29. function digDown()
  30. while turtle.detectDown() == true do
  31. turtle.digDown()
  32. end
  33. end
  34.  
  35. function forward()
  36. local keepGoing = true
  37. while keepGoing do
  38. if turtle.forward() then
  39. keepGoing = false
  40. end
  41. end
  42. end
  43.  
  44. function up()
  45. local keepGoing = true
  46. while keepGoing do
  47. if turtle.up() then
  48. keepGoing = false
  49. end
  50. end
  51. end
  52.  
  53. function down()
  54. local keepGoing = true
  55. while keepGoing do
  56. if turtle.down() then
  57. keepGoing = false
  58. end
  59. end
  60. end
  61.  
  62. function chest()
  63. if cl > 16 then
  64. cl = 1
  65. end
  66. turtle.select(cl)
  67. if turtle.getItemCount(cl) <= 0 then
  68. cl = cl + 1
  69. turtle.select(cl)
  70. end
  71. end
  72.  
  73. function chestUp()
  74.  
  75. turtle.select(cl)
  76. end
  77.  
  78. turtle.select(1)
  79.  
  80. for i = 1, u do
  81. for j = 1, r do
  82. for k = 1, f-1 do
  83. dig()
  84. digDown()
  85. chest()
  86. turtle.placeDown()
  87. forward()
  88. end
  89. if j ~= r then
  90. if j%2 ~= 0 then
  91. turtle.turnRight()
  92. dig()
  93. digDown()
  94. chest()
  95. turtle.placeDown()
  96. forward()
  97. turtle.turnRight()
  98. end
  99. if j%2 == 0 then
  100. turtle.turnLeft()
  101. dig()
  102. chest()
  103. turtle.placeDown()
  104. forward()
  105. turtle.turnLeft()
  106. end
  107. end
  108. end
  109.  
  110. if r%2 == 0 then
  111. turtle.turnRight()
  112. for b = 1, r-1 do
  113. digDown()
  114. chest()
  115. turtle.placeDown()
  116. forward()
  117. end
  118. turtle.turnRight()
  119. end
  120.  
  121. if r%2 ~= 0 then
  122. for b = 1, f-1 do
  123. turtle.back()
  124. end
  125. turtle.turnLeft()
  126. for b = 1, r-1 do
  127. digDown()
  128. chest()
  129. turtle.placeDown()
  130. forward()
  131. end
  132. turtle.turnRight()
  133. end
  134.  
  135. if i ~= u then
  136. digUp()
  137. chestUp()
  138. up()
  139. end
  140. end
  141.  
  142. for d = 1, u-1 do
  143. down()
  144. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement