Advertisement
100Toby1

Untitled

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