Blackhome

LavaLoader

Jan 6th, 2025 (edited)
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | Gaming | 0 0
  1. --distance for loading
  2. distance = ...
  3. if distance then
  4.     distance = tonumber(distance)
  5. else
  6.     distance = 35
  7. end
  8.  
  9. --Counter for found lava springs
  10. lavaCnt = {0}
  11.  
  12. local move = require("move1")
  13. local inspect = require("inspect1")
  14. local collectLava = require("collectLava1")
  15.  
  16. lavaArray = {"minecraft:lava"}
  17.  
  18. -- mines one tunnel and comes back out
  19. function mineTunnel (remainingLength)
  20.     if not (remainingLength == 0) then
  21.         move.Forward()
  22.         if  inspect.Down(lavaArray) then
  23.             collectLava.Bottom(lavaCnt)
  24.         end
  25.         mineTunnel(remainingLength - 1)
  26.         move.Forward()
  27.     else
  28.         move.turnBack()
  29.     end
  30. end
  31.  
  32. function collectLavaBelow(length)
  33.     local cnt = 0
  34.     while cnt < length do
  35.         if turtle.forward() then
  36.             cnt = cnt + 1
  37.             if inspect.Down(lavaArray) then
  38.                 collectLava.Bottom(lavaCnt)
  39.             else
  40.                 break
  41.             end
  42.         else
  43.             break
  44.         end
  45.     end
  46.     turtle.turnLeft()
  47.     turtle.turnLeft()
  48.     while cnt > 0 do
  49.         while not turtle.forward() do sleep(0.5) end
  50.         cnt = cnt - 1
  51.     end
  52. end
  53.  
  54.  
  55. turtle.dig()
  56. local success, err = turtle.dig()
  57.  
  58. if err == "No tool to dig with" then
  59.     collectLavaBelow(distance)
  60. else
  61.     mineTunnel(distance)
  62. end
  63.  
Advertisement
Add Comment
Please, Sign In to add comment