Advertisement
100Toby1

Untitled

Mar 24th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. function getItemSlots()
  2. local slots = 15
  3. for i = 1, 15 do
  4. if turtle.getItemCount(i) > 0 then
  5. slots = slots - 1
  6. end
  7. end
  8. return slots
  9. end
  10.  
  11. function autoRefuel()
  12. if turtle.getFuelLevel() <= 160 then
  13. select(16)
  14. turtle.refuel(2)
  15. end
  16. end
  17.  
  18. function dropAllItems()
  19. for i = 1, 16 do
  20. turtle.select(i)
  21. turtle.drop()
  22. end
  23. end
  24.  
  25. function dig()
  26. while turtle.inspect() do
  27. turtle.dig()
  28. turtle.suck()
  29. os.sleep(0.5)
  30. end
  31. end
  32.  
  33. function digUp()
  34. while turtle.inspectUp() do
  35. turtle.digUp()
  36. turtle.suck()
  37. os.sleep(0.5)
  38. end
  39. end
  40.  
  41. function digDown()
  42. while turtle.inspectDown() do
  43. turtle.digDown()
  44. turtle.suck()
  45. os.sleep(0.5)
  46. end
  47. end
  48.  
  49. while true do
  50. while getItemSlots() > 0 do
  51. if turtle.inspect() then
  52. autoRefuel()
  53. dig()
  54. turtle.turnRight()
  55. dig()
  56. turtle.turnLeft()
  57. turtle.turnLeft()
  58. dig()
  59. turtle.turnRight()
  60. digUp()
  61. turtle.up()
  62. dig()
  63. turtle.turnRight()
  64. dig()
  65. turtle.turnLeft()
  66. turtle.turnLeft()
  67. dig()
  68. turtle.turnRight()
  69. turtle.down()
  70. end
  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