Advertisement
gungun974

Farmer of potatoes

May 4th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. --[[
  2. Program made by gungun974
  3. I love potato!
  4. ]]--
  5.  
  6. -- declaration
  7.  
  8. -- function
  9.  
  10. function potato()
  11. if getBlockDownMeta("minecraft:potatoes", 7) then
  12. slot2 = turtle.getItemDetail(2)
  13. if slot2 ~= nil then
  14. if slot2.name == "minecraft:poisonous_potato" then
  15. turtle.select(2)
  16. turtle.transferTo(4)
  17. turtle.select(1)
  18. end
  19. end
  20. turtle.digDown()
  21. end
  22. end
  23.  
  24. function seed()
  25. if BlockDown() == false then
  26. turtle.placeDown()
  27. end
  28. end
  29.  
  30. function getBlockDownMeta( block , meta )
  31. local succes, data = turtle.inspectDown()
  32. if succes then
  33. if data.name == block and data.metadata == meta then
  34. return true
  35. else
  36. return false
  37. end
  38. else
  39. return false
  40. end
  41. end
  42.  
  43. function getBlockMeta( block , meta )
  44. local succes, data = turtle.inspect()
  45. if succes then
  46. if data.name == block and data.metadata == meta then
  47. return true
  48. else
  49. return false
  50. end
  51. else
  52. return false
  53. end
  54. end
  55.  
  56. function getBlock( block )
  57. local succes, data = turtle.inspect()
  58. if succes then
  59. if data.name == block then
  60. return true
  61. else
  62. return false
  63. end
  64. else
  65. return false
  66. end
  67. end
  68.  
  69. function getBlockUp( block )
  70. local succes, data = turtle.inspectUp()
  71. if succes then
  72. if data.name == block then
  73. return true
  74. else
  75. return false
  76. end
  77. else
  78. return false
  79. end
  80. end
  81.  
  82. function getBlockDown( block )
  83. local succes, data = turtle.inspectDown()
  84. if succes then
  85. if data.name == block then
  86. return true
  87. else
  88. return false
  89. end
  90. else
  91. return false
  92. end
  93. end
  94.  
  95. function BlockDown( block )
  96. local succes, data = turtle.inspectDown()
  97. if succes then
  98. return true
  99. else
  100. return false
  101. end
  102. end
  103.  
  104. -- start
  105. turtle.select(1)
  106.  
  107. -- loop
  108. while true do
  109.  
  110.  
  111.  
  112. potato()
  113. seed()
  114.  
  115. if getBlockMeta("minecraft:stone", 2) then
  116. turtle.turnLeft()
  117. slot9 = turtle.getItemDetail(9)
  118. if turtle.getFuelLevel() < 100 then
  119. if getBlock("minecraft:chest") then
  120. turtle.select(9)
  121. if slot9 == nil then
  122. turtle.suck()
  123. end
  124. turtle.refuel(2)
  125. turtle.select(1)
  126. end
  127. end
  128. turtle.turnLeft()
  129. end
  130.  
  131. if getBlockMeta("minecraft:stone", 6) then
  132. turtle.turnLeft()
  133. if getBlock("minecraft:chest") then
  134. turtle.select(2)
  135. turtle.drop()
  136. turtle.select(1)
  137. end
  138. turtle.turnLeft()
  139. end
  140.  
  141. if getBlock("minecraft:planks") then
  142. turtle.turnRight()
  143. turtle.forward()
  144. turtle.turnRight()
  145. potato()
  146. seed()
  147. end
  148.  
  149. if getBlock("minecraft:cobblestone") then
  150. turtle.turnLeft()
  151. turtle.forward()
  152. turtle.turnLeft()
  153. potato()
  154. seed()
  155. end
  156.  
  157. turtle.forward()
  158.  
  159. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement