BigGamingGamers

harvest

Jun 3rd, 2021 (edited)
1,626
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1.  
  2. function getItemIndex(itemName)
  3. for slot = 1, 16, 1 do
  4. local item = turtle.getItemDetail(slot)
  5. if(item ~= nil) then
  6. if(item["name"] == itemName) then
  7. return slot
  8. end
  9. end
  10. end
  11. end
  12.  
  13. function checkLeft()
  14. turtle.turnLeft()
  15. if (turtle.detect())
  16. then
  17. return true
  18. end
  19. turtle.forward()
  20. turtle.turnRight()
  21. return false
  22. end
  23.  
  24.  
  25. function succ()
  26. for i = 1, 6, 1
  27. do
  28. turtle.suck()
  29. end
  30. end
  31.  
  32. while(1)
  33. do
  34. isBlock, data = turtle.inspect()
  35.  
  36. if(isBlock)
  37. then
  38. if (data['state']['age'] == 7)
  39. then
  40. turtle.dig()
  41. succ()
  42. potatoIndex = getItemIndex("minecraft:potato")
  43. turtle.select(potatoIndex)
  44. turtle.place()
  45. turtle.dropDown(turtle.getItemCount(potatoIndex) - 1)
  46. end
  47. else
  48. potatoIndex = getItemIndex("minecraft:potato")
  49. turtle.place()
  50. end
  51.  
  52.  
  53. if (checkLeft())
  54. then
  55. turtle.turnRight()
  56. turtle.turnRight()
  57. while(not turtle.detect())
  58. do
  59. turtle.forward()
  60. end
  61. turtle.turnLeft()
  62. end
  63. end
  64.  
  65.  
  66.  
Comments
Add Comment
Please, Sign In to add comment