94Lord

Untitled

Aug 28th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. -- ( HOLZ) --
  2.  
  3. momfuellevel = 0
  4. aufsammeln = 40
  5. fuellevel = 100
  6. count = 0
  7. anzahl1 = 0
  8. anzahl2 = 0
  9. treeblock = "minecraft:log"
  10. steinblock = "minecraft:cobblestone"
  11. chestdistance = 5
  12. j = 0
  13.  
  14. function forward()
  15. while(turtle.forward()==false) do end
  16. end
  17.  
  18. function up()
  19. while(turtle.up()==false) do end
  20. end
  21.  
  22. function down()
  23. while(turtle.down()==false) do end
  24. end
  25.  
  26. function Stein()
  27. success, data = turtle.inspect()
  28. while(success and data.name==steinblock) do
  29. turtle.dig()
  30. break
  31. end
  32. end
  33.  
  34. function fell()
  35. count = count + 1
  36. print("Baum Nr. " ..count.. " wird gefaellt!")
  37. while(turtle.forward()==false) do
  38. turtle.dig()
  39. end
  40. success, data = turtle.inspectUp()
  41. while(success and data.name==treeblock) do
  42. turtle.digUp()
  43. up()
  44. success, data = turtle.inspectUp()
  45. end
  46. while(turtle.down()) do end
  47. while(turtle.back()==false) do end
  48. end
  49.  
  50. function place()
  51. turtle.select(2)
  52. turtle.place()
  53. if turtle.getItemCount(2) > 50 then
  54. aufsammeln = 0
  55. else
  56. aufsammeln = 40
  57. end
  58. turtle.select(1)
  59.  
  60. end
  61.  
  62. function collect()
  63. print("Sammle in "..aufsammeln.." Sek auf")
  64. sleep(aufsammeln)
  65. turtle.suck()
  66. while(turtle.down()==false) do end
  67. turtle.suckDown()
  68. sleep(1)
  69. turtle.suckDown()
  70. sleep(1)
  71. turtle.suckDown()
  72. sleep(1)
  73. while(turtle.up()==false) do end
  74. end
  75.  
  76. function refuel()
  77. if(turtle.getFuelLevel() < fuellevel) then
  78. turtle.select(16)
  79. if turtle.getItemCount(16) > 0 then
  80. turtle.refuel(1)
  81. momfuellevel = turtle.getFuelLevel()
  82. print("Aufgetankt "..momfuellevel.." Fuel im Tank")
  83. else
  84. print("WARNUNG KEIN FUEL (Slot 16) ")
  85. sleep(5)
  86. for i=1,4 do
  87. turtle.turnRight()
  88. end
  89. refuel()
  90. sleep(5)
  91. end
  92. turtle.select(1)
  93. end
  94. end
  95.  
  96.  
  97. function ofen()
  98. refuel()
  99. forward()
  100. forward()
  101. up()
  102. forward()
  103. turtle.select(1)
  104.  
  105. if turtle.getItemCount(1) > 10 then
  106. turtle.transferTo(15,9)
  107. turtle.select(15)
  108. turtle.dropDown(15)
  109. print("Holzkohle wird hergestellt")
  110. end
  111.  
  112. turtle.turnRight()
  113. turtle.back()
  114. down()
  115. turtle.select(16)
  116. down()
  117. forward()
  118.  
  119. if turtle.getItemCount(16) > 10 then
  120. turtle.dropUp(9)
  121.  
  122. end
  123. sleep(10)
  124. turtle.select(16)
  125. turtle.suckUp(16)
  126. turtle.select(1)
  127. turtle.turnLeft()
  128. turtle.back()
  129. up()
  130. turtle.turnLeft()
  131. turtle.turnLeft()
  132. forward()
  133. forward()
  134. refuel()
  135.  
  136. end
  137.  
  138.  
  139. function goBack(anzahl1)
  140. refuel()
  141. turtle.turnRight()
  142. turtle.turnRight()
  143. for i=1,2 do
  144. forward()
  145. end
  146. for i=1,7 do
  147. up()
  148. end
  149. anzahl1 = anzahl1 - 1
  150. anzahl1 = anzahl1 * 8
  151. for i=1,anzahl1 do
  152. forward()
  153. end
  154. end
  155.  
  156. function goBaum(anzahl2)
  157. refuel()
  158. anzahl2 = anzahl2 - 1
  159. anzahl2 = anzahl2 * 8
  160. for i=1,anzahl2 do
  161. forward()
  162. end
  163. for i=1,7 do
  164. down()
  165. end
  166. for i=1,2 do
  167. forward()
  168. end
  169. end
  170.  
  171.  
  172. -- (Programm Start Holz) --
  173.  
  174. function Baum()
  175. refuel()
  176. turtle.select(1)
  177. success, data = turtle.inspect()
  178. if(success and data.name==treeblock) then
  179. refuel()
  180. fell()
  181. place()
  182. sleep(5)
  183. collect()
  184. refuel()
  185.  
  186. else
  187. print("Kein Baum")
  188. end
  189. end
  190.  
  191. -- (Programm Start Stein) --
  192.  
  193. function abbauen()
  194.  
  195. if turtle.getItemCount(13) <= 62 then
  196.  
  197. print("Baue 1 Stack Stein ab")
  198.  
  199. while turtle.getItemCount(13) <= 62 do
  200. turtle.select(13)
  201. Stein()
  202. turtle.turnRight()
  203. Stein()
  204. turtle.turnLeft()
  205. end
  206.  
  207. turtle.select(1)
  208. print("habe nun 1 Stack Stein im Invi")
  209.  
  210. else
  211. print("Habe schon genug Steine im Invi(Slot 13) ")
  212.  
  213. end
  214. end
  215.  
  216.  
  217. -- ( Hauptprogramm) --
  218.  
  219.  
  220. for i=1,10 do
  221. print("RUNDE " ..i.."")
  222. Baum()
  223. goBack(1)
  224. ofen()
  225. goBaum(2)
  226. Baum()
  227. goBack(2)
  228. ofen()
  229. goBaum(1)
  230.  
  231. end
  232.  
  233. print("------------------------------")
  234.  
  235. for i=1,10 do
  236. print("RUNDE " ..i.."")
  237. Baum()
  238. goBack(1)
  239. turtle.turnLeft()
  240. turtle.turnLeft()
  241. goBaum(2)
  242. Baum()
  243. goBack(2)
  244. turtle.turnLeft()
  245. turtle.turnLeft()
  246. goBaum(1)
  247. Baum()
  248. goBack(1)
  249. ofen()
  250. goBaum(1)
  251.  
  252. end
  253.  
  254. --Baum()
  255.  
  256. --ofen()
  257.  
  258. --print("RUNDE " ..i.."")
  259. -- end
  260.  
  261. --refuel()
  262. --Baum()
  263. --goBack1()
  264. --ofen()
  265. --goBaum1()
  266. --print("RUNDE 1")
  267.  
  268. -- abbauen()
Advertisement
Add Comment
Please, Sign In to add comment