Advertisement
mathiaas

cubeMine

Apr 8th, 2024 (edited)
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. local args = {...}
  2.  
  3. if #args < 3 then
  4.     print("Usage: cubeMine <width> <depth> <height>")
  5.     return
  6. end
  7.  
  8.  
  9. local width = tonumber(args[1])
  10. local depth = tonumber(args[2])
  11. local height = tonumber(args[3])
  12.  
  13.  
  14. local function mineRow(steps)
  15.     for i = 1, steps do
  16.         while turtle.detect() do
  17.             turtle.dig()
  18.         end
  19.         turtle.forward()
  20.     end
  21. end
  22.  
  23.  
  24. local function mineCube(width, depth, height)
  25.     for j = 1, height do
  26.         for i = 1, width do
  27.             mineRow(depth - 1)
  28.             if i ~= width then
  29.                 if i % 2 == 1 then
  30.                     turtle.turnLeft()
  31.                     mineRow(1)
  32.                     turtle.turnLeft()
  33.                 else
  34.                     turtle.turnRight()
  35.                     mineRow(1)
  36.                     turtle.turnRight()
  37.                 end
  38.             end
  39.         end
  40.  
  41.         if j ~= height then
  42.             turtle.digDown()
  43.             turtle.down()
  44.             turtle.turnRight()
  45.             turtle.turnRight()
  46.         end
  47.     end
  48. end
  49.  
  50.  
  51. mineCube(width, depth, height)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement