Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Simple Mining Program
- -- Set the number of blocks to mine
- local distanceforward = 0
- local forward = 1 --Forward Facing
- local distanceBackward = 0
- local distanceLeft = 0
- local distanceRight = 0
- local distanceLimit = 50
- local FuelAmount = 0
- -- Check Fuel Level
- local function fuelcheck()
- FuelAmount = turtle.getFuelLevel()
- print("Fuel Level " .. FuelAmount)
- end
- -- Fuel Up
- local function Fuel()
- turtle.select(1)
- turtle.refuel(64)
- turtle.select(2)
- turtle.refuel(64)
- turtle.select(1)
- end
- local function Left()
- turtle.turnLeft()
- end
- local function Right()
- turtle.turnRight()
- end
- local function ClearAbove()
- if turtle.detectup() then
- turtle.digup()
- end
- end
- local function Clearforward()
- if turtle.detect() then
- turtle.dig()
- end
- end
- -- Function to ensure the path is clear
- local function DigAll()
- while turtle.getFuelLevel()>50 do
- while distanceRight<10 do
- while distanceforward < distanceLimit do
- ClearAbove()
- Left()
- Clearforward()
- Right()
- Right()
- Clearforward()
- Left()
- if forward == 1 then
- distanceforward = distanceforward+1
- else
- distanceforward = distanceforward-1
- end
- if forward > 0 then
- forward = 0 --Backwards
- Right()
- Clearforward()
- distanceright = distanceright+1
- turtle.forward()
- Clearforward()
- distanceright = distanceright+1
- turtle.forward()
- Clearforward()
- distanceright = distanceright+1
- turtle.forward()
- Right()
- else
- forward = 1 --Forward
- Left()
- Clearforward()
- distanceright = distanceright+1
- turtle.forward()
- Clearforward()
- distanceright = distanceright+1
- turtle.forward()
- Clearforward()
- distanceright = distanceright+1
- turtle.forward()
- Left()
- end
- end
- end
- if forward == 1 then
- Left()
- while distanceright>0 do
- turtle.forward()
- distanceright=distanceright-1
- end
- else
- Right()
- while distanceright>0 do
- turtle.forward()
- distanceright=distanceright-1
- end
- Left()
- while distanceforward > 0 do
- turtle.forward()
- distanceforward = distanceforward-1
- end
- end
- end
- end
- fuelcheck()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement