Advertisement
jhughey99

Untitled

Oct 6th, 2022
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 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. forward()
  114. end
  115. turtle.turnRight()
  116. end
  117.  
  118. if r%2 ~= 0 then
  119. for b = 1, f-1 do
  120. turtle.back()
  121. end
  122. turtle.turnLeft()
  123. for b = 1, r-1 do
  124. forward()
  125. end
  126. turtle.turnRight()
  127. end
  128.  
  129. if i ~= u then
  130. digUp()
  131. chestUp()
  132. up()
  133. end
  134. end
  135.  
  136. for d = 1, u-1 do
  137. down()
  138. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement