Advertisement
Smokefag

Tunnel down

Feb 21st, 2023 (edited)
742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. distance = 62;
  2.  
  3. function turtle.forwards(numForw)
  4.     for i = 1, numForw do
  5.         turtle.forward()
  6.     end
  7. end
  8.  
  9. function turtle.upwards(numUpw)
  10.     for i = 1, numUpw do
  11.         turtle.up()
  12.     end
  13. end
  14.  
  15. function turtle.downwards(numDownw)
  16.     for i = 1, numDownw do
  17.         turtle.down()
  18.     end
  19. end
  20.  
  21. function turtle.turns180()
  22.     for i = 1, 2 do
  23.         turtle.turnRight()
  24.     end
  25. end
  26.  
  27. function scanDown()
  28.     if turtle.detectDown() then
  29.         turtle.digDown()
  30.     end
  31. end    
  32. function scan()
  33.     if turtle.detect() then
  34.         turtle.dig()
  35.     end
  36. end
  37.  
  38. function emptyInventory()
  39.     turtle.select(1)
  40.     for i = 1, 16 do
  41.         turtle.select(i)
  42.         turtle.drop()
  43.     end
  44. end
  45.        
  46.  
  47. function mining()
  48.     for i = 1, distance do
  49.         turtle.turnRight()
  50.         scan();
  51.         turtle.turns180()
  52.         scan();
  53.         turtle.turnRight()
  54.         scanDown();
  55.         turtle.down()
  56.         i = i + 1;
  57.      end
  58.      for i = 1, distance do
  59.         turtle.up()
  60.         i = i + 1;
  61.      end
  62. end
  63.  
  64. function selectCobblestone()
  65.     for i = 1, 16 do
  66.         local itemDetail = turtle.getItemDetail(i)
  67.         if itemDetail and itemDetail.name == "minecraft:cobblestone" then
  68.             turtle.select(i)
  69.             break
  70.         end
  71.     end
  72. end
  73.  
  74. function fillFloor()
  75.     selectCobblestone()
  76.     turtle.placeDown()
  77.     turtle.turnLeft()
  78.     turtle.forward()
  79.     turtle.placeDown()
  80.     turtle.turns180()
  81.     turtle.forwards(2)
  82.     turtle.placeDown()
  83.     turtle.turns180()
  84.     turtle.forward()
  85.     turtle.turnRight()
  86. end
  87.  
  88. function mining3by3()
  89.     turtle.select(1)
  90.     mining()
  91.     fillFloor()
  92.     turtle.forward()
  93.     mining()
  94.     fillFloor()
  95.     turtle.forward()
  96.     mining()
  97.     fillFloor()
  98.     turtle.turns180()
  99.     turtle.forwards(2)
  100.     emptyInventory()
  101.     turtle.turns180()
  102. end
  103.  
  104. mining3by3()
  105.    
  106.        
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement