Advertisement
Guest User

BaumSimple

a guest
May 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. iBaum = 0
  2. iOben = 0
  3. iLinks = 0
  4. iRechts = 0
  5. iVorne = 0
  6. iHinten = 0
  7. aktiv=true
  8.  
  9. function kiste()
  10.     turtle.up()
  11.     turtle.turnLeft()
  12.     turtle.turnLeft()
  13.         for i=2,16 do
  14.         turtle.select(i)
  15.         turtle.drop()
  16.         end
  17.     turtle.turnLeft()
  18.     turtle.turnLeft()
  19.     turtle.down()
  20. end
  21.  
  22. function zurueck()
  23. iBaum = iBaum + 1
  24. for i=1,iOben do
  25. turtle.down()
  26. end
  27. turtle.back()
  28. write("Baum: ")
  29. print(iBaum)
  30. turtle.suck()
  31. turtle.down()
  32. turtle.suckDown()
  33. turtle.up()
  34. turtle.select(1)
  35. turtle.place()
  36. aktiv=false
  37. testen()
  38. aktiv=true
  39. end
  40.  
  41. function check()
  42. local success, t = turtle.inspectUp()
  43. if t.name == "minecraft:log" then
  44. turtle.digUp()
  45. turtle.up()
  46. iOben = iOben + 1
  47. else
  48. turtle.turnLeft()
  49. local success, t = turtle.inspect()
  50. if t.name == "minecraft:log" then
  51. turtle.dig()
  52. turtle.forward()
  53. iLinks = iLinks + 1
  54. else
  55. turtle.turnLeft()
  56. local success, t = turtle.inspect()
  57. if t.name == "minecraft:log" then
  58. turtle.dig()
  59. turtle.forward()
  60. iVorne = iVorne + 1
  61. else
  62. turtle.turnLeft()
  63. local success, t = turtle.inspect()
  64. if t.name == "minecraft:log" then
  65. turtle.dig()
  66. turtle.forward()
  67. iRechts = iRechts + 1
  68. else
  69. turtle.turnLeft()
  70. local success, t = turtle.inspect()
  71. if t.name == "minecraft:log" then
  72. turtle.dig()
  73. turtle.forward()
  74. iHinten = iHinten + 1
  75. else
  76. local success, t = turtle.inspectDown()
  77. if t.name == "minecraft:log" then
  78. turtle.digDown()
  79. turtle.down()
  80. iOben = iOben - 1
  81. else
  82. zurueck()
  83. end
  84. end
  85. end
  86. end
  87. end
  88. end
  89. end
  90.  
  91.  
  92. function testen()
  93. if turtle.getFuelLevel() < 20 then
  94.     turtle.select(1)
  95.     turtle.refuel()
  96. end
  97.  
  98. turtle.select(16)
  99. local iAnzahl = turtle.getItemCount()
  100. if iAnzahl > 0 then
  101. kiste()
  102. turtle.select(1)
  103. end
  104.             local success, t = turtle.inspect()
  105.     if t.name == "minecraft:log" then
  106.     turtle.dig()
  107.     turtle.forward()
  108.     else
  109.     sleep(2)
  110.     testen()
  111. end
  112. end
  113.  
  114. testen()
  115. while aktiv==true do
  116. check()
  117. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement