Advertisement
tonitch

query.lua

Dec 1st, 2022
763
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function find_chest()
  2.     repeat
  3.         turtle.turnRight()
  4.         block, data = turtle.inspect()
  5.     until data.name == "minecraft:chest"
  6. end
  7.  
  8. function empty_me()
  9.     for i = 1, 16, 1 do
  10.         turtle.select(i)
  11.         turtle.drop()
  12.     end
  13. end
  14.  
  15. function dig_square(width)
  16.     turlte.dig()
  17.     turtle.forward()
  18.     for x = 1, width, 1 do
  19.         for y = 1, width - 1, 1 do
  20.             turtle.dig()
  21.             turtle.forward()
  22.             turtle.digUp()
  23.         end
  24.         if x % 2 == 0 then
  25.             turtle.turnLeft()
  26.             turtle.dig()
  27.             turtle.forward()
  28.             turtle.digUp()
  29.             turtle.turnLeft()
  30.         else
  31.             turtle.turnRight()
  32.             turtle.dig()
  33.             turtle.forward()
  34.             turtle.digUp()
  35.             turtle.turnRight()
  36.         end
  37.     end
  38.     if width % 2 == 0 then
  39.         turtle.turnLeft()
  40.         for x = 1, width, 1 do
  41.             turtle.forward()
  42.         end
  43.         turtle.turnLeft()
  44.         turtle.forward()
  45.     else
  46.         print("turtle.right")
  47.         turtle.turnRight()
  48.         for x = 1, width, 1 do
  49.             turtle.forward()
  50.         end
  51.         turtle.turnLeft()
  52.         for y = 1, width, 1 do
  53.             turtle.forward()
  54.         end
  55.     end
  56. end
  57.  
  58. height = 0
  59. while true do
  60.     find_chest()
  61.     empty_me()
  62.     turtle.turnRight()
  63.     turtle.turnRight()
  64.     for i = 0, height, 1 do
  65.         turtle.digDown()
  66.         turtle.down()
  67.     end
  68.     dig_square(16)
  69.     for i = 0, height, 1 do
  70.         turtle.up()
  71.     end
  72.     height = height + 1
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement