CmdDebugs

trainPlaceTrackV2

Apr 17th, 2021 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. turtle.select(1)
  2. bigSleep = false
  3. count = 0
  4. function check_inventory()
  5. local all_empty = false
  6. local data = turtle.getItemDetail(turtle.getSelectedSlot())
  7.  
  8. while (turtle.getItemCount(turtle.getSelectedSlot())) <= 0 or (data.name == "minecraft:magma_block") do
  9. print('Moving slot')
  10. if turtle.getSelectedSlot() >= 16 then
  11. turtle.select(1)
  12. if all_empty then
  13. print('All inventory slots empty, shutting down')
  14. exit()
  15. end
  16. all_empty = true
  17. end
  18. turtle.select(turtle.getSelectedSlot()+1)
  19. data = turtle.getItemDetail(turtle.getSelectedSlot())
  20. end
  21. end
  22.  
  23. while true do
  24. while turtle.detect() do
  25. sleep(0.5)
  26. bigSleep = true
  27. end
  28. if turtle.detectDown() then
  29. turtle.back()
  30. end
  31. if bigSleep then
  32. sleep(7.0)
  33. bigSleep = false
  34. end
  35.  
  36. if count > 15 then
  37. turtle.select(16)
  38. else
  39. turtle.select(1)
  40. end
  41.  
  42. check_inventory()
  43.  
  44. if count > 18 then
  45. count = 0
  46.  
  47. end
  48. count = count + 1
  49.  
  50. turtle.placeDown()
  51. turtle.forward()
  52. end
Add Comment
Please, Sign In to add comment