100Toby1

Untitled

Mar 23rd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 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 p.dig() do end
  29. end
  30.  
  31. function digUp()
  32. autoRefuel()
  33. while p.digUp() do end
  34. end
  35.  
  36. function digDown()
  37. autoRefuel()
  38. while p.digDown() do end
  39. end
  40.  
  41. p.setShapeCircle(9)
  42.  
  43. while true do
  44. autoRefuel()
  45.  
  46. while getItemSlots() > 0 do
  47. dig()
  48. turtle.turnRight()
  49. dig()
  50. turtle.turnLeft()
  51. turtle.turnLeft()
  52. dig()
  53. turtle.turnRight()
  54. digUp()
  55. turtle.up()
  56. dig()
  57. turtle.turnRight()
  58. dig()
  59. turtle.turnLeft()
  60. turtle.turnLeft()
  61. dig()
  62. turtle.turnRight()
  63. turtle.down()
  64. turtle.forward()
  65. end
  66. --Turtle ran out of space
  67. turtle.turnRight()
  68. turtle.turnRight()
  69. --Turn Back
  70. while true do
  71. local _,data = turtle.inspect()
  72. if data.name == "IronChest:BlockIronChest" then break end
  73. autoRefuel()
  74. turtle.forward()
  75. end
  76. dropAllItems()
  77. turtle.turnRight()
  78. turtle.turnRight()
  79. end
Advertisement
Add Comment
Please, Sign In to add comment