Advertisement
Hoover240gaming

farming

Jul 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. --Farming
  2. local currentW = 1
  3. local currentD = 1
  4. width = 9
  5. depth = 9
  6. lr = 0
  7. function getWheat()
  8. local success, data = turtle.inspectDown()
  9. if success then
  10. if data.name == "minecraft:wheat" then
  11. if data.metadata == 7 then
  12. turtle.digDown()
  13. end
  14. end
  15. end
  16. end
  17. function seed()
  18. local existS = turtle.detectDown()
  19. if existS == false then
  20. -- turtle.down(1)
  21. -- turtle.up(1)
  22. turtle.digDown()
  23. existSeedslot = 0
  24. for i = 1 , 16 do
  25. turtle.select(i)
  26. local data = turtle.getItemDetail(i)
  27. if data ~= nill and data.name == "minecraft:wheat_seeds" then
  28. existSeedslot = i
  29. i = 16
  30. end
  31. data = 0
  32. end
  33. if existSeedslot ~= 0 then
  34. turtle.select(existSeedslot)
  35. turtle.placeDown()
  36. end
  37. end
  38. end
  39. function back()
  40. for i = 2 , width do
  41. turtle.back()
  42. end
  43. if lr == 1 then
  44. turtle.turnLeft()
  45. for i = 2 , depth do
  46. turtle.back()
  47. end
  48. end
  49. end
  50. getWheat()
  51. seed()
  52. local loop = 1
  53. while loop == 1 do
  54. currentD = 1
  55. while currentD < depth do
  56. turtle.forward(1)
  57. getWheat()
  58. seed()
  59. currentD = currentD + 1
  60. end
  61. if lr == 0 then
  62. turtle.turnRight()
  63. lr = 1
  64. else
  65. turtle.turnLeft()
  66. lr = 0
  67. end
  68. if currentW < width then
  69. turtle.forward()
  70. currentW = currentW + 1
  71.  
  72. if lr == 0 then
  73. turtle.turnLeft()
  74. else
  75. turtle.turnRight()
  76. end
  77. getWheat()
  78. seed()
  79. else
  80. back()
  81. currentW = 1
  82. getWheat()
  83. seed()
  84. lr = 0
  85. end
  86. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement