94Lord

Untitled

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