Advertisement
Guest User

Untitled

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