Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1.  
  2.  
  3. function harvest()
  4. print ("Harvesting..")
  5. turtle.dig()
  6. turtle.suck()
  7. plant()
  8. end
  9.  
  10.  
  11. function inspect()
  12. local success,i =turtle.inspect()
  13. if success then
  14. local f = textutils.serialise(i.state.age)
  15. if f=="3" then
  16. print("Fully grown beetroot detected.")
  17. harvest()
  18. end
  19. elseif not success then
  20. plant()
  21. end
  22. end
  23.  
  24. function turn()
  25. turtle.turnLeft()
  26. end
  27.  
  28. function fuel()
  29. local t = turtle.getFuelLevel()
  30. if t<50 then
  31. print("Fuel less then 50.Please insert fuel to resume")
  32. while turtle.getFuelLevel()<50 do
  33. for i=1,16 do
  34. turtle.select(i)
  35. turtle.refuel()
  36. end
  37. end
  38. end
  39. print("Current fuel:".. t)
  40. end
  41.  
  42. function plant()
  43. for i=1,16 do
  44. local s = turtle.select(i)
  45. local c = turtle.getItemDetail()
  46. if c then
  47. local g =c.name
  48. if g=="minecraft:beetroot_seeds" then
  49. print("Planting new seed..")
  50. turtle.place()
  51. end
  52. end
  53. end
  54. end
  55.  
  56. function transfer()
  57. for i=1,16 do
  58. local t = turtle.select(i)
  59. local k = turtle.getItemCount()
  60. local m = turtle.getItemDetail()
  61.  
  62. if m then
  63. local f = m.name
  64. print (f)
  65. if (f=="minecraft:beetroot" or f=="minecraft:beetroot_seeds") then
  66. if k>4 then
  67. turtle.dropDown(k-4)
  68. print ("Storing ".. k-4 .." cocoa beans")
  69. end
  70. end
  71. end
  72. end
  73. end
  74.  
  75. while true do
  76. fuel()
  77. for i=1,4 do
  78. inspect()
  79. turn()
  80. end
  81. transfer()
  82. os.sleep(5)
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement