Advertisement
PETREKILLAH

Untitled

Oct 1st, 2020 (edited)
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. function GetSeeds()
  2. local count = 16
  3. repeat
  4. local currentSlot = turtle.getSelectedSlot()
  5. local data = turtle.getItemDetail(currentSlot)
  6. if data.name == "minecraft:wheat_seeds" then
  7. return true
  8. else
  9. turtle.select((currentSlot%16)+1)
  10. count = count - 1
  11. end
  12. currentSlot = turtle.getSelectedSlot()
  13. data = turtle.getItemDetail(currentSlot)
  14. until(count == 0)
  15. return false
  16. end
  17.  
  18. function ReplaceSeed()
  19. local passed,data = turtle.inspectDown()
  20. if passed then
  21. if data.name == "minecraft:wheat" then
  22. if data.state.age == 7 then
  23. turtle.digDown()
  24. if GetSeeds() then
  25. turtle.placeDown()
  26. else
  27. print("OOF")
  28. end
  29.  
  30. end
  31. end
  32. end
  33. end
  34.  
  35. function ReturnHome(w)
  36. turtle.back()
  37. turtle.turnRight()
  38. for i=1,w,1 do
  39. turtle.forward()
  40. end
  41. turtle.turnLeft()
  42. end
  43.  
  44. local w = arg[1] or 10
  45. for i=1,w,1 do
  46. for j=1,w-1,1 do
  47. ReplaceSeed()
  48. turtle.forward()
  49. end
  50. if i%2 == 1 then
  51. ReplaceSeed()
  52. turtle.turnLeft()
  53. turtle.forward()
  54. turtle.turnLeft()
  55. else
  56. ReplaceSeed()
  57. turtle.turnRight()
  58. turtle.forward()
  59. turtle.turnRight()
  60. end
  61. end
  62. --ReturnHome(w)
  63.  
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement