Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1.  
  2. function harvest()
  3. print ("Harvesting..")
  4. turtle.dig()
  5. turtle.suck()
  6. end
  7.  
  8.  
  9. function inspect()
  10. local success,i =turtle.inspect()
  11. if success then
  12. local f = textutils.serialise(i.name)
  13. if (f=="minecraft:melon_block" or f=="minecraft:pumpkin") then
  14. print("Plant detected.")
  15. harvest()
  16. end
  17. end
  18. end
  19.  
  20. function turn()
  21. turtle.turnLeft()
  22. end
  23.  
  24. function fuel()
  25. local t = turtle.getFuelLevel()
  26. if t<50 then
  27. print("Fuel less then 50.Please insert fuel to resume")
  28. while turtle.getFuelLevel()<50 do
  29. for i=1,16 do
  30. turtle.select(i)
  31. turtle.refuel()
  32. end
  33. end
  34. end
  35. print("Current fuel:".. t)
  36. end
  37.  
  38.  
  39. function transfer()
  40. for i=1,16 do
  41. local t = turtle.select(i)
  42. local m = turtle.getItemDetail()
  43.  
  44. if m then
  45. local f = m.name
  46. print (f)
  47. if (f=="minecraft:pumpkin" or f=="minecraft:melon") then
  48. turtle.dropDown()
  49. print ("Storing plants...")
  50. end
  51. end
  52. end
  53. end
  54.  
  55. while true do
  56. fuel()
  57. for i=1,4 do
  58. inspect()
  59. turn()
  60. end
  61. transfer()
  62. os.sleep(5)
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement