Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- if #tArgs ~= 1 then
- print( "Usage: miner <distance>" )
- return
- end
- local maxDist = tonumber( tArgs[1] )
- if maxDist < 1 then
- print( "Distance must be positive" )
- return
- end
- local function find(itemName)
- for curSlot = 1,16 do
- local data = turtle.getItemDetail(curSlot)
- if data.name == itemName then
- return curSlot
- end
- end
- return false
- end
- local function digAround()
- while turtle.detectUp() do
- turtle.digUp()
- end
- if turtle.detectDown() then
- local success, data = turtle.inspectDown()
- if success then
- if not (data.name == "minecraft:cobblestone") and not (data.name == "minecraft:stone") and not (data.name == "minecraft:sand") and not (data.name == "minecraft:dirt") and not (data.name == "minecraft:gravel") and not (data.name == "chisel:marble2") and not (data.name == "chisel:limestone2") then
- turtle.digDown()
- end
- end
- end
- turtle.select(find("minecraft:cobblestone"))
- turtle.placeDown()
- end
- local function checkFuel(level)
- if turtle.getFuelLevel() <= level then
- turtle.select(find("minecraft:coal"))
- turtle.refuel(1)
- end
- end
- for curDist=0,maxDist do
- checkFuel(10)
- while turtle.detect() do
- turtle.dig()
- digAround()
- end
- turtle.turnLeft()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- digAround()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- digAround()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- if curDist ~= maxDist then
- turtle.forward()
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for curDist=0,maxDist do
- turtle.forward()
- while turtle.detect() do
- turtle.dig()
- end
- end
- for curSlot = 1,16 do
- turtle.select(curSlot)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
Advertisement
Add Comment
Please, Sign In to add comment