94Lord

Untitled

Sep 3rd, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.86 KB | None | 0 0
  1. momfuellevel = 0
  2. aufsammeln = 40
  3. fuellevel = 100
  4. count = 0
  5. anzahl1 = 0
  6. anzahl2 = 0
  7. treeblock = "minecraft:log"
  8. steinblock = "minecraft:cobblestone"
  9. chestdistance = 5
  10. zaehler = 0
  11. j = 0
  12.  
  13. -- (Standart)--
  14. function forward()
  15. refuel()
  16. while(turtle.forward()==false) do
  17. print("WARNUNG Block im Weg !!")
  18. turtle.attack()
  19. turtle.dig()
  20. sleep(2)
  21. end
  22. end
  23.  
  24. function up()
  25. refuel()
  26. while(turtle.up()==false) do
  27. if turtle.detectUp() then
  28. turtle.digUp()
  29. end
  30. end
  31. end
  32.  
  33. function down()
  34. refuel()
  35. while(turtle.down()==false) do
  36. if turtle.detectDown() then
  37. turtle.digDown()
  38. end
  39. turtle.attackDown()
  40. end
  41. end
  42.  
  43. function back()
  44. refuel()
  45. while(turtle.back()==false) do
  46. print("WARNUNG Block im Weg !!")
  47. end
  48. end
  49.  
  50. function refuel()
  51.  
  52. if fuellevel > 5000 then
  53. fuellevel = 3000
  54. end
  55.  
  56. if fuellevel < 11 then
  57. fuellevel = 60
  58. end
  59.  
  60. fuellevel = fuellevel + 1
  61. if(turtle.getFuelLevel() < fuellevel) then
  62. turtle.select(16)
  63. if turtle.getItemCount(16) > 0 then
  64. turtle.refuel(1)
  65. momfuellevel = turtle.getFuelLevel()
  66. print("Aufgetankt "..momfuellevel.." Fuel im Tank")
  67. print("Neuer Sollwert "..fuellevel.." Fuel")
  68. refuel()
  69. else
  70. print("WARNUNG KEIN FUEL (Slot 16) ")
  71. print("Neuer Sollwert "..fuellevel.." Fuel")
  72. fuellevel = fuellevel - 50
  73. sleep(1)
  74. for i=1,4 do
  75. turtle.turnRight()
  76. end
  77. refuel()
  78. sleep(1)
  79. end
  80. turtle.select(1)
  81. end
  82. end
  83.  
  84. function Stein()
  85. success, data = turtle.inspect()
  86. while(success and data.name==steinblock) do
  87. turtle.dig()
  88. break
  89. end
  90. end
  91.  
  92. -- (Programm Start Stein) --
  93.  
  94. -- überprüfe ob Cobblegenerator gebaut ist --
  95.  
  96. function abbauen()
  97. if turtle.getItemCount(13) <= 61 then
  98. turtle.dig()
  99. sleep(5)
  100. success, data = turtle.inspect()
  101. if (success and data.name==steinblock) then
  102. print("Wasser und Lava vorhanden")
  103. else
  104. print("-------------------------------")
  105. print("kein Cobblegenerator vorhanden !")
  106. print("Fuege Wasser und Lava hinzu !")
  107. print("Wasser Links und Rechts")
  108. print("Lava in der Mitte")
  109. print("-------------------------------")
  110. sleep(2)
  111. print("...")
  112. sleep(2)
  113. print("Turtle Startet dann automatisch")
  114. end
  115. end
  116. if turtle.getItemCount(13) <= 62 then
  117.  
  118. print("Baue 1 Stack Stein ab")
  119.  
  120. while turtle.getItemCount(13) <= 62 do
  121. turtle.select(13)
  122. Stein()
  123. turtle.turnLeft()
  124. Stein()
  125. turtle.turnRight()
  126.  
  127. end
  128.  
  129. turtle.select(1)
  130. print("habe nun 1 Stack Stein im Invi")
  131.  
  132. else
  133. print("Habe schon genug Steine im Invi")
  134. print("(Slot 13) ")
  135.  
  136. end
  137. end
  138. --(Baum)-----------------------------------------------------------
  139. function fell1()
  140. count = count + 1
  141. print("Baum Nr. " ..count.. " wird gefaellt!")
  142. while(turtle.forward()==false) do
  143. turtle.dig()
  144. end
  145. success, data = turtle.inspectUp()
  146. while(success and data.name==treeblock) do
  147. turtle.digUp()
  148. up()
  149. success, data = turtle.inspectUp()
  150. end
  151. while(turtle.down()) do end
  152. while(turtle.back()==false) do end
  153. end
  154.  
  155. function place()
  156. turtle.select(4)
  157. turtle.place()
  158. turtle.select(1)
  159. end
  160.  
  161. function collect()
  162. for i=1,4 do
  163. turtle.suck()
  164. turtle.turnRight()
  165. end
  166. end
  167.  
  168. function fc()
  169. forward()
  170. for i=1,4 do
  171. turtle.suck()
  172. turtle.turnRight()
  173. end
  174. end
  175.  
  176. function fell()
  177. turtle.select(8)
  178. success, data = turtle.inspect()
  179. if(success and data.name==treeblock) then
  180. fell1()
  181. end
  182. end
  183.  
  184.  
  185. function weg1()
  186. for i=1,4 do
  187. fc()
  188. fc()
  189. turtle.turnRight()
  190. fc()
  191. turtle.turnRight()
  192. turtle.turnRight()
  193. forward()
  194. fc()
  195. turtle.turnRight()
  196. turtle.turnRight()
  197. forward()
  198. turtle.turnLeft()
  199.  
  200. fc()
  201. fc()
  202. turtle.turnRight()
  203. fc()
  204. fell()
  205. place()
  206. turtle.turnRight()
  207. turtle.turnRight()
  208. forward()
  209. fc()
  210. fell()
  211. place()
  212. turtle.turnRight()
  213. turtle.turnRight()
  214. fc()
  215. turtle.turnLeft()
  216. end
  217. end
  218.  
  219. function Baumlinie1()
  220. turtle.turnRight()
  221. forward()
  222. weg1()
  223. forward()
  224. forward()
  225. forward()
  226. forward()
  227. turtle.turnRight()
  228. turtle.turnRight()
  229. weg1()
  230. forward()
  231. forward()
  232. forward()
  233. forward()
  234. forward()
  235. turtle.turnRight()
  236. end
  237.  
  238. function Baumlinie2()
  239. turtle.turnRight()
  240. turtle.turnRight()
  241. forward()
  242. weg1()
  243. forward()
  244. forward()
  245. forward()
  246. forward()
  247. turtle.turnRight()
  248. turtle.turnRight()
  249. weg1()
  250. forward()
  251. forward()
  252. forward()
  253. forward()
  254. forward()
  255. end
  256.  
  257. --(ofen)----------------------------------------------------------------
  258.  
  259. function Steinofenbef()
  260. if turtle.getItemCount(13) > 20 then
  261. turtle.select(13)
  262. turtle.dropDown(19)
  263. turtle.select(1)
  264. end
  265. end
  266.  
  267. function Steinofenent()
  268. if turtle.getItemCount(14) < 50 then
  269. turtle.select(14)
  270. turtle.suckUp(10)
  271. turtle.select(1)
  272. end
  273. end
  274.  
  275. function ofenbef()
  276. if turtle.getItemCount(16) > 5 then
  277. turtle.select(16)
  278. turtle.drop(4)
  279. turtle.select(1)
  280. end
  281. end
  282.  
  283. function Holzofenbef()
  284. if turtle.getItemCount(8) > 10 then
  285. turtle.select(8)
  286. turtle.dropDown(9)
  287. turtle.select(1)
  288. end
  289. end
  290.  
  291. function Holzofenent()
  292. if turtle.getItemCount(16) < 50 then
  293. turtle.select(16)
  294. turtle.suckUp(10)
  295. turtle.select(1)
  296. end
  297. end
  298.  
  299. --(Sortieren)----------------------------------------------------------------
  300.  
  301. function Drop()
  302.  
  303. for i=1,16 do
  304. if turtle.getItemCount(i) > 0 then
  305. turtle.select(i)
  306. turtle.dropUp()
  307. end
  308. end
  309. end
  310.  
  311. function Suck()
  312. turtle.select(1)
  313. for i=1,16 do
  314. turtle.suckUp()
  315. end
  316. end
  317.  
  318.  
  319. function Sortieren1(x,z)
  320.  
  321. if turtle.getItemCount(x) > 0 then
  322. for j=1,16 do
  323. turtle.select(x)
  324. turtle.transferTo(j)
  325. end
  326. end
  327.  
  328. for i=1,16 do
  329. if turtle.getItemCount(i) > 0 then
  330. if turtle.getItemDetail(i).name == z then
  331. turtle.select(i)
  332. turtle.transferTo(x)
  333. end
  334. end
  335. end
  336. end
  337.  
  338. function Sortieren()
  339. Sortieren1(13,"minecraft:cobblestone")
  340. Sortieren1(14,"minecraft:stone")
  341. Sortieren1(15,"minecraft:stonebrick")
  342. Sortieren1(16,"minecraft:coal")
  343. Sortieren1(4,"minecraft:sapling")
  344. Sortieren1(8,"minecraft:log")
  345. Sortieren1(12,"minecraft:planks")
  346.  
  347. print("Sortiert")
  348. end
  349.  
  350. function Dropa()
  351. forward()
  352. forward()
  353. turtle.select(1)
  354. turtle.dropUp()
  355. turtle.select(2)
  356. turtle.dropUp()
  357. turtle.select(3)
  358. turtle.dropUp()
  359. turtle.select(5)
  360. turtle.dropUp()
  361. turtle.select(6)
  362. turtle.dropUp()
  363. turtle.select(7)
  364. turtle.dropUp()
  365. turtle.select(9)
  366. turtle.dropUp()
  367. turtle.select(10)
  368. turtle.dropUp()
  369. turtle.select(11)
  370. turtle.dropUp()
  371. turtle.select(1)
  372.  
  373. back()
  374. back()
  375. end
  376.  
  377. function Dropb()
  378. turtle.select(4)
  379. turtle.dropUp()
  380. turtle.select(8)
  381. turtle.dropUp()
  382. turtle.select(12)
  383. turtle.dropUp()
  384. turtle.select(13)
  385. turtle.dropUp()
  386. turtle.select(14)
  387. turtle.dropUp()
  388. turtle.select(15)
  389. turtle.dropUp()
  390. turtle.select(16)
  391. turtle.dropUp()
  392. turtle.select(1)
  393. end
  394. --(Craft)------------------------------------------------------------------------------------------------
  395. function CraftStein()
  396. y = 0
  397. if turtle.getItemCount(14) > 5 and turtle.getItemCount(15) < 60 then
  398. turtle.select(14)
  399. turtle.transferTo(1)
  400. Dropb()
  401. turtle.select(1)
  402. turtle.transferTo(14)
  403. end
  404.  
  405. while turtle.getItemCount(14) > 5 and turtle.getItemCount(15) < 60 do
  406.  
  407. y = 1
  408. turtle.select(14)
  409. turtle.transferTo(1,1)
  410. turtle.select(14)
  411. turtle.transferTo(2,1)
  412. turtle.select(14)
  413. turtle.transferTo(5,1)
  414. turtle.select(14)
  415. turtle.transferTo(6,1)
  416.  
  417. end
  418. turtle.select(15)
  419. Dropb()
  420. turtle.craft()
  421. turtle.select(1)
  422. if y > 0 then
  423. Drop()
  424. Suck()
  425. Sortieren()
  426. Dropa()
  427. print("Steinziegel hergestellt")
  428. y = 0
  429. end
  430. end
  431.  
  432. function CraftBretter()
  433. z = 0
  434. if turtle.getItemCount(8) > 5 and turtle.getItemCount(12) < 60 then
  435. turtle.select(8)
  436. turtle.transferTo(1)
  437. Dropb()
  438. turtle.select(1)
  439. turtle.transferTo(8)
  440. end
  441.  
  442. while turtle.getItemCount(8) > 5 and turtle.getItemCount(12) < 60 do
  443.  
  444. turtle.select(8)
  445. turtle.transferTo(1,1)
  446.  
  447. z = 1
  448. end
  449. turtle.select(8)
  450. Dropb()
  451. turtle.craft()
  452. turtle.select(1)
  453. if z > 0 then
  454. Drop()
  455. Suck()
  456. Sortieren()
  457. Dropa()
  458. print("Bretter hergestellt")
  459. z = 0
  460. end
  461. end
  462.  
  463. function CraftStoneslab()
  464. turtle.select(16)
  465. turtle.refuel(3)
  466. up()
  467. up()
  468. turtle.select(13)
  469. turtle.transferTo(1)
  470. Dropb()
  471. turtle.select(1)
  472. turtle.transferTo(13)
  473.  
  474. turtle.select(13)
  475. turtle.transferTo(1,3)
  476. turtle.select(13)
  477. turtle.transferTo(2,3)
  478. turtle.select(13)
  479. turtle.transferTo(3,3)
  480.  
  481. turtle.select(5)
  482. Dropb()
  483. turtle.craft()
  484. down()
  485. down()
  486. end
  487.  
  488. function Invi()
  489.  
  490. up()
  491. up()
  492. Drop()
  493. Suck()
  494. Sortieren()
  495. Dropa()
  496. CraftStein()
  497. CraftBretter()
  498. Drop()
  499. Suck()
  500. Sortieren()
  501. Dropa()
  502. down()
  503. down()
  504.  
  505. end
  506.  
  507. function Ofen()
  508. up()
  509. turtle.turnRight()
  510. --(Kohle nr1)--
  511. ofenbef()
  512. turtle.turnRight()
  513. --(Kohle nr.2)--
  514. ofenbef()
  515.  
  516. up()
  517. forward()
  518. --(Ofen nr1)--
  519. Steinofenbef()
  520. turtle.turnRight()
  521. turtle.turnRight()
  522. forward()
  523.  
  524. turtle.turnRight()
  525. forward()
  526. --(Ofen nr2)--
  527. Holzofenbef()
  528. turtle.turnRight()
  529. turtle.turnRight()
  530. forward()
  531. turtle.turnRight()
  532. down()
  533. down()
  534. back()
  535. Steinofenent()
  536. forward()
  537. turtle.turnRight()
  538. forward()
  539. Holzofenent()
  540. back()
  541. turtle.turnLeft()
  542. end
  543.  
  544. function ring()
  545. turtle.select(13)
  546. for i= 1,4 do
  547. turtle.turnRight()
  548. turtle.place()
  549. end
  550. turtle.select(1)
  551. end
  552.  
  553. function baucobble()
  554. turtle.turnLeft()
  555. forward()
  556. forward()
  557. ring()
  558. up()
  559. ring()
  560. up()
  561. turtle.turnRight()
  562. forward()
  563. forward()
  564. turtle.turnRight()
  565. forward()
  566. forward()
  567. down()
  568. down()
  569. ring()
  570. up()
  571. ring()
  572. up()
  573.  
  574. forward()
  575. turtle.turnRight()
  576. forward()
  577. down()
  578.  
  579. turtle.select(13)
  580. turtle.placeDown()
  581.  
  582. up()
  583. forward()
  584. forward()
  585. turtle.turnRight()
  586. down()
  587. down()
  588. forward()
  589.  
  590. turtle.select(13)
  591. turtle.place()
  592.  
  593. turtle.turnRight()
  594. forward()
  595. turtle.select(1)
  596. print("Cobblegenerator gebaut !!")
  597. end
  598.  
  599. function baukiste()
  600.  
  601. Sortieren1(1,"minecraft:chest")
  602. Sortieren1(2,"minecraft:furnace")
  603. Sortieren1(13,"minecraft:cobblestone")
  604.  
  605. if turtle.getItemCount(1) > 1 and turtle.getItemCount(2) > 1 and turtle.getItemCount(13) > 17 then
  606.  
  607. up()
  608. up()
  609. turtle.select(1)
  610. turtle.placeUp()
  611. forward()
  612. forward()
  613. turtle.placeUp()
  614. back()
  615. back()
  616. down()
  617. turtle.turnRight()
  618. turtle.select(2)
  619. turtle.place()
  620. turtle.turnRight()
  621. turtle.select(2)
  622. turtle.place()
  623. turtle.turnRight()
  624. turtle.turnRight()
  625. down()
  626. else
  627. print("------------------------------")
  628. print("WARNUNG")
  629. print("Fuege 2 Kisten und 2 Ofen hinzu")
  630. print("Zudem mindistens 18 Cobblestone")
  631. print("ein paar Setzlinge")
  632. print("und genug Fuel")
  633. print("------------------------------")
  634. sleep(5)
  635. baukiste()
  636. end
  637. end
  638.  
  639. function baublockup()
  640. for i= 1,4 do
  641. forward()
  642. forward()
  643. forward()
  644. forward()
  645. turtle.placeUp()
  646. end
  647. end
  648.  
  649. function baufarm()
  650.  
  651. if turtle.getItemCount(13) > 8 then
  652. CraftStoneslab()
  653. back()
  654. back()
  655. up()
  656. up()
  657. up()
  658. up()
  659. up()
  660. turtle.turnRight()
  661. forward()
  662. baublockup()
  663. turtle.turnLeft()
  664. forward()
  665. forward()
  666. forward()
  667. forward()
  668. turtle.placeUp()
  669. turtle.turnLeft()
  670.  
  671. for i= 1,3 do
  672. forward()
  673. forward()
  674. forward()
  675. forward()
  676. turtle.placeUp()
  677. end
  678. forward()
  679. forward()
  680. forward()
  681.  
  682.  
  683. turtle.turnLeft()
  684. forward()
  685. forward()
  686. forward()
  687. baublockup()
  688.  
  689. turtle.turnRight()
  690. forward()
  691. forward()
  692. forward()
  693. forward()
  694. turtle.turnRight()
  695. turtle.placeUp()
  696. for i= 1,3 do
  697. forward()
  698. forward()
  699. forward()
  700. forward()
  701. turtle.placeUp()
  702. end
  703. forward()
  704. forward()
  705. forward()
  706. down()
  707. down()
  708. down()
  709. down()
  710. down()
  711. turtle.turnRight()
  712. forward()
  713. forward()
  714. turtle.turnLeft()
  715. forward()
  716. forward()
  717. else
  718. Start()
  719. end
  720. end
  721.  
  722.  
  723. --(Start)---------------------------------------------------
  724. function Start()
  725. turtle.turnRight()
  726. forward()
  727. turtle.turnLeft()
  728. success, data = turtle.inspect()
  729. if (success and data.name==steinblock) then
  730. print("Cobblegenerator vorhanden")
  731. turtle.turnLeft()
  732. forward()
  733. turtle.turnRight()
  734. else
  735. turtle.turnLeft()
  736. forward()
  737. turtle.turnRight()
  738. baukiste()
  739. Invi()
  740. baucobble()
  741. Invi()
  742. abbauen()
  743. Invi()
  744. baufarm()
  745.  
  746. --- bau cobble baum farm usw.
  747. end
  748. end
  749.  
  750. --(Programm)------------------------------------------
  751.  
  752. Start()
  753.  
  754. while true do
  755. Invi()
  756. abbauen()
  757. Ofen()
  758. Invi()
  759. Baumlinie1()
  760. Invi()
  761. abbauen()
  762. Ofen()
  763. Invi()
  764. Baumlinie2()
  765. zaehler = zaehler +1
  766. print("-------------------------------")
  767. print("-------------------------------")
  768. print("Runde " ..zaehler.. "")
  769. print("-------------------------------")
  770. print("-------------------------------")
  771.  
  772. end
Advertisement
Add Comment
Please, Sign In to add comment