Advertisement
Guest User

Untitled

a guest
Oct 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. --Quarry Code
  2. --Variables:
  3. Args = {...}
  4.  
  5.  
  6. --functions:
  7.  
  8. function graveldig() --Gravel Shield for forward digging and the digging
  9. if turtle.detect() then
  10. bool,data=turtle.inspect()
  11. while data.name ~= "minecraft:flowing_water" and data.name ~= "minecraft:flowing_lava" and turtle.inspect()~= false do
  12. turtle.dig()
  13. print(graveldig)
  14. end
  15. end
  16. end
  17.  
  18. function graveldigUp() --Gravel Shield for Up digging and the digging Up
  19. if turtle.detectUp() then
  20. bool,data=turtle.inspectUp()
  21. while data.name ~= "minecraft:flowing_water" and data.name ~= "minecraft:flowing_lava" and turtle.inspectUp()~= false do
  22. turtle.digUp()
  23. os.sleep(9/20)
  24. end
  25. end
  26. end
  27. function TurtleRefuel() --Refuel
  28. if turtle.getFuelLevel() < 320 and turtle.getItemCount(1) > 3 then
  29. turtle.select(1)
  30. turtle.refuel(3)
  31. end
  32. end
  33.  
  34. function UDF() --Break up down in front and move forward (with gravel protection)
  35. if turtle.detect() then
  36. turtle.dig()
  37. print(dig)
  38. end
  39. graveldig()
  40. if turtle.detectDown() then
  41. turtle.digDown()
  42. end
  43. if turtle.detectUp() then
  44. turtle.digUp()
  45. end
  46. turtle.forward()
  47. end
  48.  
  49. function CobbleVoid() --Search inventory for Cobble and void it, move itemslot 15 to an empty one
  50. if turtle.getItemCount(16) > 1 then
  51. for u=2,15 do
  52. itemdetail = turtle.getItemDetail(u)
  53. if itemdetail ~= nil then
  54. if itemdetail.name=="minecraft:cobblestone" or itemdetail.name=="etfuturum:stone" or itemdetail.name=="minecraft:cobblestone"then
  55. turtle.select(u)
  56. os.sleep(2/20)
  57. turtle.drop()
  58. turtle.select(16)
  59. turtle.transferTo(u)
  60. end
  61. end
  62.  
  63. end
  64. turtle.select(1)
  65. end
  66. end
  67.  
  68. function Down3() --move 3 down
  69. for k=1,3 do
  70. if turtle.detectDown() then
  71. turtle.digDown()
  72. end
  73. turtle.down()
  74. end
  75. end
  76.  
  77. function Up3() --move 3 up
  78. for k=1,3 do
  79. if turtle.detectUp() then
  80. turtle.digUp()
  81. end
  82. graveldigUp()
  83. turtle.up()
  84. end
  85. end
  86. function TurnAround() --Turn around
  87. turtle.turnLeft()
  88. turtle.turnLeft()
  89. end
  90.  
  91. function EndoftheRoad() --Turns around and down at the end of the road
  92. Down3()
  93. TurnAround()
  94. end
  95.  
  96.  
  97. function ItemDelivery() --Drop items in the chest in front of it (needs to be trapped or regular)
  98. bool,data=turtle.inspect()
  99. if data.name == "minecraft:chest" or data.name == "minecraft:trapped_chest" then
  100. for p=2,16 do
  101. turtle.select(p)
  102. os.sleep(2/20)
  103. turtle.drop()
  104. end
  105. else
  106. turtle.dig()
  107. end
  108. turtle.select(1)
  109. end
  110.  
  111. function BacktoChest() --Moves Turtle by q blocks back to chest
  112. Up3()
  113. turtle.turnLeft()
  114. for u=1,q do
  115. while turtle.detect() do
  116. turtle.dig()
  117. end
  118. turtle.forward()
  119. end
  120. turtle.turnRight()
  121.  
  122. end
  123. function LeavingChest() --Moves Turtle by q blocks from the chest
  124.  
  125. turtle.turnRight()
  126.  
  127. for u=1,q do
  128. graveldig()
  129. turtle.forward()
  130. end
  131. turtle.turnRight()
  132. end
  133.  
  134. --Parameters:
  135.  
  136. i=0
  137. j=tonumber(Args[2])
  138. r=tonumber(Args[1])
  139. q=0
  140. --Code:
  141.  
  142. for y=1,r do
  143. while i <= j do
  144.  
  145. TurtleRefuel()
  146. CobbleVoid()
  147.  
  148. if i < 0.5*j then
  149. UDF()
  150. elseif i == 0.5*j then
  151. EndoftheRoad()
  152. elseif i > 0.5*j then
  153. UDF()
  154. end
  155. i=i+1
  156. end
  157.  
  158. BacktoChest()
  159. ItemDelivery()
  160. q=q+1
  161. LeavingChest()
  162. i=0
  163. print(i)
  164. print(q)
  165. end
  166. print("type name 'repeats' 'length' for specifications")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement