Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local sand, area = 0, 0
- local function fueled_forward()
- while turtle.getFuelLevel() <= 0 do
- turtle.select(1)
- turtle.refuel(1)
- end
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- end
- local function is_sand()
- local _, data = turtle.inspectDown()
- return data.name == 'minecraft:'..args[2]
- end
- while true do
- for x = 1, args[1], 1 do
- for z = 1, args[1], 1 do
- if is_sand() then
- turtle.digDown()
- sand = sand + 1
- end
- fueled_forward()
- area = area + 1
- print(math.floor(sand/area*100)..'% '..args[2]..' so far')
- end
- if x%2 == 0 then
- turtle.turnLeft()
- fueled_forward()
- turtle.turnLeft()
- fueled_forward()
- else
- turtle.turnRight()
- fueled_forward()
- turtle.turnRight()
- fueled_forward()
- end
- end
- print('This layer was'..math.floor(sand/area*100)..'% '..args[2])
- if sand/area < .4 then
- print('Not much '..args[2]..' left, stopping')
- break
- end
- print('Moving on to next layer')
- sand = 0
- area = 0
- turtle.digDown()
- turtle.down()
- if args[1]%2 == 0 then
- turtle.turnLeft()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement