Advertisement
Telerabi

Schnecken MiningTurtle

Jun 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.03 KB | None | 0 0
  1. print("Wieviele Spiralen? [3/5/7] [max 13]")
  2. max = tonumber(read())
  3. print("Wieviele Etagen? [max 5]")
  4. etage = tonumber(read())
  5. b = 0
  6. f = 3
  7. k = 0
  8. g = 0
  9. slot = 3
  10.  
  11. if(max >= 7) then
  12.     f=6
  13. elseif(max >=9 then
  14.     f=9
  15. end
  16.  
  17. function Back()
  18.     turtle.turnRight()
  19.     for x=1, max * g  do
  20.         while(turtle.detect() == false) do
  21.             turtle.forward()
  22.         end
  23.         turtle.turnLeft()
  24.         if(turtle.detectDown() == false) then
  25.             turtle.turnLeft()
  26.             for i=1, 5 do
  27.                 turtle.down()
  28.             end
  29.         end        
  30.     end
  31. end
  32.        
  33. function Hoch()
  34.     turtle.turnRight()
  35.     for x=1, 5 do
  36.         turtle.digUp()
  37.         turtle.up()
  38.     end
  39. end
  40.  
  41. function Sauber()
  42.     for x=0, 13 do
  43.         turtle.select(slot)
  44.         data= turtle.getItemDetail()
  45.         number = turtle.getItemCount()
  46.         if(number > 0) then
  47.         if(data.name=="minecraft:dirt" or data.name=="minecraft:cobblestone") then
  48.             turtle.dropDown()
  49.         end
  50.         end
  51.         slot = slot + 1
  52.     end
  53. end
  54.  
  55. function Abbau()
  56.     if(turtle.detectUp()) then
  57.         turtle.digUp()
  58.     end
  59.     while(turtle.detect()) do
  60.         success, data = turtle.inspect()
  61.         if(success and data.name == "minecraft:gravel") then
  62.             turtle.dig()
  63.             turtle.turnLeft()
  64.             turtle.turnRight()
  65.         else
  66.             turtle.dig()
  67.         end
  68.     end
  69. end
  70.  
  71. function Sicherheit()
  72.     turtle.select(2)
  73.     turtle.turnLeft()
  74.     turtle.place()
  75.     turtle.turnRight()
  76.     turtle.turnRight()
  77.     turtle.select(1)
  78.     turtle.digDown()
  79.     turtle.placeDown()
  80. end
  81.  
  82. function SicherheitBoden()
  83.     if(turtle.detect() == false) then
  84.         turtle.select(2)
  85.         turtle.placeDown()
  86.         turtle.select(1)
  87.     end
  88. end
  89.  
  90. function Schnecke()
  91.     while(b+4 <= max + f) do
  92.         if(k == 2) then
  93.             b = b + 4
  94.             k = 0
  95.         end
  96.         for i=1, 4+b do
  97.             Abbau()
  98.             turtle.forward()
  99.             SicherheitBoden()
  100.         end
  101.         Sicherheit()
  102.         k = k + 1      
  103.     end
  104. end
  105.  
  106. turtle.dig()
  107. turtle.forward()
  108. turtle.turnRight()
  109. turtle.turnRight()
  110. turtle.select(2)
  111. turtle.place()
  112. turtle.select(1)
  113. turtle.turnRight()
  114. turtle.turnRight()
  115.  
  116. while(etage >= 1 and etage <= 5) do
  117.     k = 0
  118.     b = 0
  119.     Schnecke()
  120.     if(etage > 1) then
  121.         Hoch()
  122.     end
  123.     etage = etage - 1
  124.     g = g + 1
  125. end
  126. Sauber()
  127. Back()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement