DustyHands

quarry

Apr 10th, 2021 (edited)
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. os.loadAPI("hare")
  2.  
  3. local cliArgs = {...}
  4. local length = tonumber(cliArgs[1])
  5. local width = tonumber(cliArgs[2])
  6.  
  7. local distFd = tonumber(length * width + length + width)
  8. local a = "minecraft:cobblestone"
  9. local b = "minecraft:stone"
  10. local c = "minecraft:dirt"
  11. local d = "chisel:basalt2"
  12.  
  13. function dropTrash()
  14.     while hare.selectItem(a) do
  15.         turtle.dropDown()
  16.     end
  17.     while hare.selectItem(b) do
  18.         turtle.dropDown()
  19.     end
  20.     while hare.selectItem(c) do
  21.         turtle.dropDown()
  22.     end
  23.     while hare.selectItem(d) do
  24.         turtle.dropDown()
  25.     end
  26.     turtle.select(1)
  27. end
  28.  
  29. function fuelCheck()
  30.   while turtle.getFuelLevel() < distFd do
  31.     hare.selectItem("minecraft:coal")
  32.     turtle.refuel()
  33.   end
  34. end
  35.  
  36. function makeLap()
  37.   dropTrash()
  38.   fuelCheck()
  39.   while turtle.detect() do
  40.     turtle.dig()
  41.   end
  42.   while turtle.detectDown() do
  43.     turtle.digDown()
  44.   end
  45.   while turtle.detectUp() do
  46.     turtle.digUp()
  47.   end
  48. end
  49.  
  50. if length == nil or width == nil or cliArgs[1] == '?' then
  51.     print('Usage: quarry <length> <width>')
  52.     return
  53. end
  54.  
  55. dropTrash()
  56.  
  57. while true do
  58.     turtle.dig()
  59.     turtle.forward()
  60.     hare.sweepMine(length, width, makeLap)
  61.     print("Finished mining.")
  62.     break
  63. end
Add Comment
Please, Sign In to add comment