Advertisement
94Lord

Untitled

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