Advertisement
100Toby1

Untitled

Mar 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. function getItemSlots()
  2. local slots = 16
  3. for i = 1, 16 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() <= 80 then
  13. turtle.refuel()
  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. while true do
  25. autoRefuel()
  26.  
  27. while getItemSlots() > 0 do
  28. while turtle.dig() do end
  29. while turtle.digUp() do end
  30. autoRefuel()
  31. turtle.forward()
  32. end
  33. --Turtle ran out of space
  34. turtle.turnRight()
  35. turtle.turnRight()
  36. --Turn Back
  37. while true do
  38. local _,data = turtle.inspect()
  39. if data.name == "minecraft:chest" then break end
  40. autoRefuel()
  41. turtle.forward()
  42. end
  43. dropAllItems()
  44. turtle.turnRight()
  45. turtle.turnRight()
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement