naxishere

miney

Jan 20th, 2021 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. --Slot 1: Ender Chest to dumps items into.
  2. --Slot 2: Fuel
  3.  
  4.  
  5. --Variables:
  6.  
  7. A = 0
  8. B = 0
  9. C = 0
  10.  
  11.  
  12. --Functions
  13.  
  14.  
  15. --refuel
  16. local function refuel()
  17. if turtle.getFuelLevel() < 40 then
  18. turtle.select(2)
  19. turtle.refuel(10)
  20. end
  21. end
  22.  
  23.  
  24. --Put Items in Ender Chest
  25. local function dumptochest()
  26. if turtle.getItemCount(16) ~= 0 then
  27. turtle.digDown()
  28. turtle.select(1)
  29. turtle.placeDown()
  30. for i = 3,16 do
  31. turtle.select(i)
  32. turtle.dropDown()
  33. end
  34. turtle.select(1)
  35. turtle.digDown()
  36. end
  37. end
  38.  
  39.  
  40. -- Mines
  41. local function mining()
  42. refuel()
  43. turtle.dig()
  44. local f = turtle.forward()
  45. if f then
  46. A = A + 1
  47. end
  48. turtle.digUp()
  49. turtle.digDown()
  50. sleep(0.2)
  51. end
  52.  
  53. --Returns Home
  54. local function gohome()
  55. refuel()
  56. turtle.dig()
  57. local f = turtle.forward()
  58. if f then
  59. A = A + 1
  60. sleep(0.3)
  61. end
  62. end
  63.  
  64. -- Code
  65.  
  66. if C == 0 then
  67. write("How Long do you want your tunnels?")
  68. distance = io.read()
  69. distance = tonumber(distance)
  70. end
  71.  
  72.  
  73. while A < distance do
  74. dumptochest()
  75. mining()
  76. end
  77.  
  78. turtle.turnLeft()
  79. mining()
  80. turtle.turnLeft()
  81.  
  82. A = 0
  83.  
  84. while A < distance do
  85. dumptochest()
  86. mining()
  87. end
  88.  
  89. turtle.turnRight()
  90. mining()
  91. turtle.turnRight()
  92.  
  93. A = 0
  94.  
  95. while A < distance do
  96. dumptochest()
  97. mining()
  98. end
  99.  
  100. turtle.turnLeft()
  101. mining()
  102. turtle.turnLeft()
  103.  
  104. A = 0
  105.  
  106. while A < distance do
  107. dumptochest()
  108. mining()
  109. end
  110.  
Add Comment
Please, Sign In to add comment