Advertisement
Alfaver

Wheat Farm

Jul 10th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. -- Automatic wheat farm by Alfaver
  2.  
  3. local function HarvestGo ()
  4. turtle.digDown ()
  5. turtle.forward ()
  6. end
  7.  
  8. local function HarvestLeft ()
  9. turtle.digDown ()
  10. turtle.turnLeft ()
  11. turtle.forward ()
  12. turtle.turnLeft ()
  13. end
  14.  
  15. local function HarvestRight ()
  16. turtle.digDown ()
  17. turtle.turnRight ()
  18. turtle.forward ()
  19. turtle.turnRight ()
  20. end
  21.  
  22. local function PlantGo ()
  23. turtle.select (1)
  24. turtle.placeDown ()
  25. turtle.select (13)
  26. turtle.placeDown ()
  27. turtle.forward ()
  28. end
  29.  
  30. local function PlantLeft ()
  31. turtle.select (1)
  32. turtle.placeDown ()
  33. turtle.select (13)
  34. turtle.placeDown ()
  35. turtle.turnLeft ()
  36. turtle.forward ()
  37. turtle.turnLeft ()
  38. end
  39.  
  40. local function PlantRight ()
  41. turtle.select (1)
  42. turtle.placeDown ()
  43. turtle.select (13)
  44. turtle.placeDown ()
  45. turtle.turnRight ()
  46. turtle.forward ()
  47. turtle.turnRight ()
  48. end
  49.  
  50. local function Coal ()
  51. if turtle.getFuelLevel () < 500 then
  52. turtle.up ()
  53. turtle.select (16)
  54. turtle.suck ()
  55. shell.run ("refuel 64")
  56. turtle.suck ()
  57. shell.run ("refuel 64")
  58. turtle.suck ()
  59. shell.run ("refuel 64")
  60. turtle.suck ()
  61. shell.run ("refuel 64")
  62. else
  63. sleep (1)
  64. end
  65. end
  66.  
  67. local function Bone ()
  68. turtle.select (15)
  69. if turtle.getItemCount (15) > 63 then
  70. turtle.drop ()
  71. turtle.select (13)
  72. turtle.suck ()
  73. else
  74. turtle.select (13)
  75. turtle.suck ()
  76. end
  77. end
  78.  
  79. local function Check_Bone ()
  80. turtle.select (13)
  81. if turtle.getItemCount (13) < 25 then
  82. Bone ()
  83. else
  84. sleep (1)
  85. end
  86.  
  87. turtle.select (13)
  88. if turtle.getItemCount (13) < 25 then
  89. turtle.turnRight ()
  90. turtle.turnRight ()
  91. shell.run ("shutdown")
  92. else
  93. turtle.turnRight ()
  94. turtle.turnRight ()
  95. end
  96. end
  97.  
  98. -- Create a 5X5 harvest cycle with final drop of item in the 16th slot, in a front chest
  99. local function Harvest ()
  100. print ("Sto raccogliendo...")
  101.  
  102. sleep (1)
  103. HarvestGo ()
  104. HarvestGo ()
  105. HarvestGo ()
  106. HarvestGo ()
  107. HarvestRight ()
  108. HarvestGo ()
  109. HarvestGo ()
  110. HarvestGo ()
  111. HarvestGo ()
  112. HarvestLeft ()
  113. HarvestGo ()
  114. HarvestGo ()
  115. HarvestGo ()
  116. HarvestGo ()
  117. HarvestRight ()
  118. HarvestGo ()
  119. HarvestGo ()
  120. HarvestGo ()
  121. HarvestGo ()
  122. HarvestLeft ()
  123. HarvestGo ()
  124. HarvestGo ()
  125. HarvestGo ()
  126. HarvestGo ()
  127. turtle.digDown ()
  128. turtle.select (16)
  129. turtle.drop ()
  130. turtle.turnRight ()
  131. turtle.turnRight ()
  132. end
  133.  
  134. -- Create a 5X5 plant cycle with final check of fuel and n°of bone meal. If the fuel/bone meal level low, the turtle provide to recharge it self
  135. local function Plant ()
  136. print ("Sto piantando...")
  137.  
  138. sleep (1)
  139. PlantGo ()
  140. PlantGo ()
  141. PlantGo ()
  142. PlantGo ()
  143. PlantRight ()
  144. PlantGo ()
  145. PlantGo ()
  146. PlantGo ()
  147. PlantGo ()
  148. PlantLeft ()
  149. PlantGo ()
  150. PlantGo ()
  151. PlantGo ()
  152. PlantGo ()
  153. PlantRight ()
  154. PlantGo ()
  155. PlantGo ()
  156. PlantGo ()
  157. PlantGo ()
  158. PlantLeft ()
  159. PlantGo ()
  160. PlantGo ()
  161. PlantGo ()
  162. PlantGo ()
  163. turtle.select (1)
  164. turtle.placeDown ()
  165. turtle.select (13)
  166. turtle.placeDown ()
  167. end
  168.  
  169. -- Create an false infinity loop. False because if the aren't enough bone meal also after the refill the turtle should turn off
  170.  
  171. while true do
  172. Harvest ()
  173. Plant ()
  174. Coal ()
  175. Check_Bone ()
  176. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement