Advertisement
appleguy1999

Strip Mine

Apr 26th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. local tArgs = { ... }
  2. local length = 0;
  3. if #tArgs ~= 1 then
  4. print("Strip Mining...")
  5. length = 100
  6. else
  7.  
  8. length = tonumber( tArgs[1] )
  9. if length < 1 then
  10. print( "Length must be positive" )
  11. return
  12. else
  13. print( "Strip Mining..." )
  14. end
  15.  
  16. end
  17.  
  18. local depth = 0
  19. local torch = 0
  20. local distance = 0
  21.  
  22. function sortInv()
  23. for i = 1, 16 do
  24. if turtle.getItemSpace(i) > 0 then
  25. turtle.select(i)
  26. for j = i, 16 do
  27. if turtle.compareTo(j) then
  28. turtle.transferTo(i, turtle.getItemCount(j))
  29. end
  30. end
  31. end
  32. end
  33. end
  34.  
  35. local function aboutFace()
  36. turtle.turnLeft()
  37. turtle.turnLeft()
  38. end
  39.  
  40. for n=1,length do
  41. turtle.select(2)
  42. turtle.placeDown()
  43. turtle.select(1)
  44. turtle.turnLeft()
  45. turtle.dig()
  46. aboutFace()
  47. turtle.dig()
  48. while turtle.detectUp() do
  49. turtle.digUp()
  50. sleep(0.5)
  51. end
  52. turtle.up()
  53. turtle.dig()
  54. aboutFace()
  55. turtle.dig()
  56. turtle.digUp()
  57. while turtle.detectUp() do
  58. turtle.digUp()
  59. sleep(0.5)
  60. end
  61. turtle.up()
  62. turtle.dig()
  63. aboutFace()
  64. turtle.dig()
  65. turtle.down()
  66. turtle.down()
  67. turtle.turnLeft()
  68. turtle.dig()
  69. while turtle.detect() do
  70. turtle.dig()
  71. end
  72. turtle.forward()
  73. distance = distance + 1
  74. if torch == 8 then
  75. aboutFace()
  76. turtle.place()
  77. aboutFace()
  78. torch = 0
  79. sortInv()
  80. else
  81. torch = torch + 1
  82. end
  83. for m=3,16 do
  84. turtle.select(m)
  85. if turtle.getItemDetail() ~= nil then
  86. if turtle.getItemDetail().name == "minecraft:cobblestone" or turtle.getItemDetail().name == "minecraft:dirt" then
  87. turtle.drop()
  88. end
  89. end
  90. end
  91. if turtle.getItemCount(1) == 0 then break end
  92. end
  93.  
  94. aboutFace()
  95. turtle.digUp()
  96. turtle.up()
  97. for n=1,distance do
  98. if turtle.detect() then
  99. turtle.dig()
  100. turtle.forward()
  101. else
  102. turtle.forward()
  103. end
  104. end
  105.  
  106. aboutFace()
  107. print("Finished Strip Mining")
  108. print(distance)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement