Advertisement
Padilk

Untitled

Feb 22nd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. function nextSlot()
  2. n = turtle.getSelectedSlot() + 1
  3. if n > 16 then n = 1 end
  4. turtle.select(n)
  5. os.sleep(0.1)
  6. end
  7. function checkBucket()
  8. if turtle.getItemDetail(turtle.getSelectedSlot()) == nil then return false end
  9. return true
  10.  
  11. end
  12. function getMilk()
  13. if not checkBucket() then
  14. itr = 0
  15. while not checkBucket() do nextSlot() itr = itr+1 end
  16. if itr > 20 then
  17. write("Sleep 10s after ")
  18. write(itr)
  19. print(" iterates")
  20. os.sleep(10)
  21. end
  22. end
  23. return turtle.place()
  24. end
  25. c=0
  26. while true do
  27. os.sleep(0.1)
  28. os.queueEvent("randomEvent")
  29. os.pullEvent()
  30. if(redstone.getInput("back")) then
  31. os.sleep(60)
  32. else
  33. if getMilk() then c=c+1 end
  34. write(c)
  35. print(" B of milk collected")
  36. end
  37.  
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement