--[[ ** Prep the Turtle before running! ** Slots 1,2,3 are for blocks not to mine (smooth stone, gravel, dirt) Slot 15 is the block to backfill holes (recommend cobble) Slot 16 is for fuel ]]-- consoleID = 1 depth = 0 function fuel() if turtle.getFuelLevel() <= depth + 10 then turtle.select(16) turtle.refuel(1) rednet.send(consoleID,"Refueled. Fuel level: "..turtle.getFuelLevel()) end end function isValuable() if turtle.detect() == false then return false end for i=1,3 do turtle.select(i) if turtle.compare() then return false end end return true end function checkWalls(dp) for j=1,4 do if isValuable() then rednet.send(consoleID,"Found ore at depth "..dp) turtle.dig() end turtle.turnRight() end end ------ ( Program Start ) ------ rednet.open("right") term.clear() print("Ben's Simple Turtle Miner") print("-------------------------") term.write("Go on mining run? (y/n): ") while read() == "y" do depth = 0 print("Commencing mining.") rednet.send(consoleID,"Commencing mining.") fuel() turtle.digDown() for st=1,2 do turtle.down() depth = depth + 1 turtle.digDown() end -- plug entrance hole turtle.select(15) turtle.placeUp() while not turtle.detectDown() do fuel() turtle.down() depth = depth + 1 if depth%10==0 then rednet.send(consoleID,"At depth "..depth) end checkWalls(depth) turtle.digDown() end rednet.send(consoleID,"Moving to next shaft location...") for mv=1,6 do fuel() turtle.up() depth = depth - 1 end -- move forward 2 blocks for z=1,2 do fuel() while not turtle.forward() do turtle.dig() sleep(.8) end end -- turn right and move one block turtle.turnRight() fuel() while not turtle.forward() do turtle.dig() sleep(.8) end turtle.turnLeft() -- go down to bedrock turtle.digDown() while not turtle.detectDown() do fuel() turtle.down() depth = depth + 1 turtle.digDown() end rednet.send(consoleID,"Returning to surface!") for k=depth,3,-1 do checkWalls(k) turtle.digUp() fuel() while not turtle.up() do turtle.digUp() sleep(.5) end if k%10 == 0 then rednet.send(consoleID,"At depth "..k) end end fuel() turtle.digUp() turtle.up() turtle.digUp() turtle.up() -- fill exit hole turtle.select(15) turtle.placeDown() turtle.forward() turtle.forward() turtle.turnRight() turtle.forward() turtle.turnLeft() term.write("Go on mining run? (y/n): ") end print("Cancelled mining.") rednet.send(consoleID,"Cancelled mining.") rednet.close("right")