-- CONFIG local DISTANCE = 50 -- UTILITY local function refuelIfNeeded() if turtle.getFuelLevel() == "unlimited" then return end if turtle.getFuelLevel() < 100 then for i = 1, 16 do turtle.select(i) if turtle.refuel(1) then break end end end end local function isOre(data) return data and data.name and string.find(data.name, "ore") end -- VEIN MINING local function mineVein() for i = 1, 4 do local success, data = turtle.inspect() if success and isOre(data) then turtle.dig() turtle.forward() mineVein() turtle.back() end turtle.turnRight() end local successUp, dataUp = turtle.inspectUp() if successUp and isOre(dataUp) then turtle.digUp() turtle.up() mineVein() turtle.down() end local successDown, dataDown = turtle.inspectDown() if successDown and isOre(dataDown) then turtle.digDown() turtle.down() mineVein() turtle.up() end end -- MOVE FORWARD SAFELY local function digForward() while turtle.detect() do turtle.dig() sleep(0.2) end turtle.forward() end -- MAIN MINING LOOP for i = 1, DISTANCE do refuelIfNeeded() -- Bottom block digForward() mineVein() -- Top block (2-high tunnel) turtle.digUp() mineVein() end -- RETURN HOME turtle.turnLeft() turtle.turnLeft() for i = 1, DISTANCE do turtle.forward() end turtle.turnLeft() turtle.turnLeft() print("Mining complete!")