Advertisement
Guest User

Mining Turtle Tunnel

a guest
Dec 11th, 2019
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. print("How long should I go forward for?")
  2. length=tonumber(read())
  3. current=0
  4. oneBehind=-1
  5. faceDepth=10
  6. chestDirection="right"
  7. print("How far am I from the chest?")
  8. chestDist=tonumber(read())
  9. chestCurrent=0
  10.  
  11. function DigFace()
  12. turtle.turnLeft()
  13. for i=1,faceDepth do
  14. turtle.dig()
  15. turtle.digDown() turtle.down()
  16. end
  17.  
  18. turtle.turnRight() turtle.turnRight()
  19. for i=1,faceDepth do
  20. turtle.dig() turtle.up()
  21. end
  22. turtle.turnLeft()
  23. end
  24.  
  25. function EmptyInventory(dist)
  26. turtle.turnRight() turtle.turnRight()
  27. while current>0 do
  28. turtle.forward()
  29. current=current-1
  30. end
  31. if chestDirection=="right" then turtle.turnRight()
  32. else turtle.turnLeft() end
  33.  
  34. while chestCurrent<chestDist do
  35. turtle.forward()
  36. chestCurrent=chestCurrent+1
  37. end
  38. turtle.down()
  39.  
  40. for i=1,16 do
  41. turtle.select(i)
  42. turtle.dropDown()
  43. end
  44. turtle.select(1)
  45.  
  46. turtle.turnRight() turtle.turnRight()
  47. turtle.up()
  48.  
  49. while currentChest>0 do
  50. turtle.forward()
  51. currentChest=currentChest-1
  52. end
  53.  
  54. if chestDirection=="right" then turtle.turnLeft()
  55. else turtle.turnRight() end
  56.  
  57. while current<dist do
  58. turtle.forward()
  59. current=current+1
  60. end
  61. end
  62.  
  63. while current<length do
  64. if oneBehind<current then DigFace() end
  65. turtle.dig()
  66. oneBehind=oneBehind+1
  67. if turtle.forward() then
  68. current=current+1
  69. oneBehind=current-1
  70. end
  71. if turtle.getItemCount(16)>0 then EmptyInventory(current) end
  72. end
  73.  
  74. EmptyInventory(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement