DaddyTigerOf3

turtle_miner.lua

Jul 19th, 2021 (edited)
1,119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local width, height, depth = 1,1,1
  2. if (arg[1]) then
  3.     width = tonumber(arg[1])
  4. end
  5. if (arg[2]) then
  6.     height = tonumber(arg[2])
  7. end
  8. if (arg[3]) then
  9.     depth = tonumber(arg[3])
  10. end
  11. print("Width: " .. width .. ", Height: " .. height .. ", Depth: " .. depth)
  12. while turtle.getFuelLevel() < turtle.getFuelLimit() do
  13.     local itemInfo = turtle.getItemDetail(1)
  14.     print(textutils.serialize(itemInfo))
  15.     if (itemInfo == nil) then
  16.         print(turtle.getFuelLevel() .. "/" .. turtle.getFuelLimit())
  17.         break
  18.     elseif (itemInfo.name == "minecraft:coal" or itemInfo.name == "minecraft:charcoal") then
  19.         turtle.select(1)
  20.         turtle.refuel(1)
  21.     end
  22. end
  23. local has_block, data = turtle.inspect()
  24. if has_block then
  25.     print(textutils.serialize(data))
  26.     print(turtle.dig())
  27.     print(turtle.forward())
  28.     print(turtle.turnRight())
  29. else
  30.     print(turtle.forward())
  31.     print(turtle.turnRight())
  32. end
  33.  
  34. for i=1,depth,1 do
  35.     for j=1,height,1 do
  36.         for k=1,width-1,1 do
  37.             print("Width: "..k..", Height: "..j..", Depth: "..i)
  38.             turtle.dig()
  39.             turtle.forward()
  40.         end
  41.         for x=width,1,-1 do
  42.             turtle.back()
  43.         end
  44.         if j < height then
  45.             turtle.digUp()
  46.             turtle.up()
  47.         end
  48.     end
  49.     for y=height,1,-1 do
  50.         turtle.down()
  51.     end
  52.     if i < depth then
  53.         turtle.turnLeft()
  54.         turtle.dig()
  55.         turtle.forward()
  56.         turtle.turnRight()
  57.     end
  58. end
Add Comment
Please, Sign In to add comment