Advertisement
100Toby1

Untitled

Mar 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. p = peripheral.wrap("right")
  2.  
  3. function getItemSlots()
  4. local slots = 16
  5. for i = 1, 16 do
  6. if turtle.getItemCount(i) > 0 then
  7. slots = slots - 1
  8. end
  9. end
  10. return slots
  11. end
  12.  
  13. function autoRefuel()
  14. if turtle.getFuelLevel() <= 80 then
  15. turtle.refuel(1)
  16. end
  17. end
  18.  
  19. function dropAllItems()
  20. for i = 1, 16 do
  21. turtle.select(i)
  22. turtle.drop()
  23. end
  24. end
  25.  
  26. function dig()
  27. autoRefuel()
  28. while turtle.inspect() do
  29. p.dig()
  30. os.sleep(0.5)
  31. end
  32. end
  33.  
  34. function digUp()
  35. autoRefuel()
  36. while turtle.inspectUp() do
  37. p.digUp()
  38. os.sleep(0.5)
  39. end
  40. end
  41.  
  42. function digDown()
  43. autoRefuel()
  44. while turtle.inspectDown() do
  45. p.digDown()
  46. os.sleep(0.5)
  47. end
  48. end
  49.  
  50. while true do
  51. autoRefuel()
  52.  
  53. while getItemSlots() > 0 do
  54. dig()
  55. turtle.turnRight()
  56. dig()
  57. turtle.turnLeft()
  58. turtle.turnLeft()
  59. dig()
  60. turtle.turnRight()
  61. digUp()
  62. turtle.up()
  63. dig()
  64. turtle.turnRight()
  65. dig()
  66. turtle.turnLeft()
  67. turtle.turnLeft()
  68. dig()
  69. turtle.turnRight()
  70. turtle.down()
  71. turtle.forward()
  72. end
  73. --Turtle ran out of space
  74. turtle.turnRight()
  75. turtle.turnRight()
  76. --Turn Back
  77. while true do
  78. local _,data = turtle.inspect()
  79. if data.name == "IronChest:BlockIronChest" then break end
  80. autoRefuel()
  81. turtle.forward()
  82. end
  83. dropAllItems()
  84. turtle.turnRight()
  85. turtle.turnRight()
  86. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement