Doyle3694

gravel_dig

Apr 19th, 2022 (edited)
602
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local length = tonumber(arg[1])
  2.  
  3. local function CheckInventorySpace()
  4.     while true do
  5.         for i=1,16 do
  6.             if turtle.getItemCount(i) == 0 then
  7.                 return
  8.             end
  9.         end
  10.  
  11.         input("Inventory full, please clear inventory then press enter to continue...")
  12.     end
  13. end
  14.  
  15. turtle.digDown()
  16. turtle.digUp()
  17. for i=1,length do
  18.     local sucked = false
  19.     repeat
  20.         CheckInventorySpace()
  21.         local dug = turtle.dig()
  22.  
  23.         CheckInventorySpace()
  24.         sucked = turtle.suckUp()
  25.         if sucked and not dug then
  26.             sleep(0.1)
  27.         end
  28.     until (not sucked) and turtle.forward()
  29.  
  30.     CheckInventorySpace()
  31.     turtle.digUp()
  32.  
  33.     CheckInventorySpace()
  34.  
  35.     local success, info = turtle.inspectDown()
  36.     if success and (info.name == "minecraft:sand" or info.name == "minecraft:gravel") then
  37.         CheckInventorySpace()
  38.         turtle.digDown()
  39.     end
  40. end
Add Comment
Please, Sign In to add comment