ravneravn

turtle ender miner

Jun 3rd, 2013
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --pastebin get WWSRZmNu mine
  2.  
  3. area = 20
  4.  
  5. function moveForward()
  6. while not turtle.forward() do
  7. turtle.dig()
  8. end
  9. end
  10.  
  11. function moveUp()
  12. while not turtle.up() do
  13. turtle.digUp()
  14. end
  15. end
  16.  
  17. --#### COMPARE UP ####
  18. function compareUp()
  19. turtle.select(1)
  20. turtle.compareUp()
  21. if turtle.compareUp() == true then
  22. print("Stone")
  23. else
  24.  
  25. turtle.select(2)
  26. turtle.compareUp()
  27. if turtle.compareUp() == true then
  28. print("Gravel")
  29. else
  30.  
  31. turtle.select(3)
  32. turtle.compareUp()
  33. if turtle.compareUp() == true then
  34. print("Marble")
  35. else
  36.  
  37. turtle.select(4)
  38. turtle.compareUp()
  39. if turtle.compareUp() == true then
  40. print("Dirt")
  41. else
  42.  
  43. turtle.digUp()
  44. print("Valuable found")
  45. end
  46. end
  47. end
  48. end
  49. end
  50.  
  51. --#### COMPARE DOWN ####
  52. function compareDown()
  53. turtle.select(1)
  54. turtle.compareDown()
  55. if turtle.compareDown() == true then
  56. print("Stone")
  57. else
  58.  
  59. turtle.select(2)
  60. turtle.compareDown()
  61. if turtle.compareDown() == true then
  62. print("Gravel")
  63. else
  64.  
  65. turtle.select(3)
  66. turtle.compareDown()
  67. if turtle.compareDown() == true then
  68. print("Marble")
  69. else
  70.  
  71. turtle.select(4)
  72. turtle.compareDown()
  73. if turtle.compareDown() == true then
  74. print("Dirt")
  75. else
  76.  
  77. turtle.digDown()
  78. print("Valuable found")
  79. end
  80. end
  81. end
  82. end
  83. end
  84.  
  85. --#### DROP OFF ####
  86. function dropOff()
  87. turtle.dig()
  88. turtle.select(16)
  89. turtle.place()
  90. for i = 5, 15 do
  91. turtle.select(i)
  92. turtle.drop()
  93. end
  94. turtle.select(16)
  95. turtle.dig()
  96. end
  97.  
  98. --#### MINE ROW ####
  99. function mineRow()
  100. for i = 1, area do
  101. moveForward()
  102. compareUp()
  103. compareDown()
  104. end
  105. dropOff()
  106. end
  107.  
  108. --#### MINE 10x10 ###
  109. function mineSquare()
  110. for i = 1, area/2 do
  111. mineRow()
  112. turtle.turnRight()
  113. moveForward()
  114. turtle.turnRight()
  115. mineRow()
  116. turtle.turnLeft()
  117. moveForward()
  118. turtle.turnLeft()
  119. end
  120.  
  121. turtle.turnLeft()
  122. for i = 1, area do
  123. moveForward()
  124. end
  125.  
  126. turtle.turnRight()
  127. for i = 1,3 do
  128. moveUp()
  129. end
  130.  
  131. end
  132.  
  133. -- #### MINE SEVERAL ROWS ####
  134. function mine()
  135. for i = 1, 7 do
  136. mineSquare()
  137. end
  138. end
  139.  
  140.  
  141.  
  142. --#### TO BEDROCK ####
  143. function toBedrock()
  144. mineStart = yLvl - yStart
  145. for i = 1, mineStart do
  146. turtle.digDown()
  147. turtle.down()
  148. end
  149. end
  150.  
  151.  
  152. -- #### RETURN TO SURFACE ####
  153. function goUp()
  154. for i = 1, yLvl-(yStart+22) do
  155. moveUp()
  156. end
  157. end
  158.  
  159.  
  160.  
  161.  
  162.  
  163. --#### LOOP ####
  164. print("What is my Y level?")
  165. yLvl = io.read()
  166.  
  167. print("I will mine a "..area.."x"..area.." area")
  168. print("what Y level would you like me to start at?")
  169. yStart = io.read()
  170.  
  171. toBedrock()
  172. mine()
  173. goUp()
  174.  
  175. print("finished")
RAW Paste Data