Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- distance = args[1]
- function CheckFuel()
- if turtle.getFuelLevel() < 10 then
- for i=1, 16 do
- turtle.select(i)
- if turtle.refuel(0) == true then
- turtel.refuel(1)
- return;
- end
- end
- end
- turtle.select(1)
- end
- function CheckForStorage()
- if turtle.getItemCount(16) > 0 then
- print("Full! Attempting unloading.")
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- turtle.place()
- turtle.select(2)
- if turtle.drop() == true then
- for i=3, 16 do
- turtle.select(i)
- turtle.drop()
- end
- end
- if turtle.getItemCount(16) > 0 then
- print("Can't unload. First slot was not a chest!")
- turtle.dig()
- print("Waiting for inventory to be empty")
- while turtle.getItemCount(16) > 0 do
- sleep(1)
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- function MineAboveBelow()
- while turtle.detectUp() do
- CheckForStorage()
- turtle.digUp()
- end
- while turtle.detectDown() do
- CheckForStorage()
- turtle.digDown()
- end
- end
- function MineInFront()
- while turtle.detect() do
- CheckForStorage()
- turtle.dig()
- end
- end
- function MineLayer()
- MineAboveBelow()
- turtle.turnLeft()
- MineInFront()
- turtle.forward()
- MineAboveBelow()
- turtle.back()
- turtle.turnRight()
- turtle.turnRight()
- MineInFront()
- turtle.forward()
- MineAboveBelow()
- turtle.back()
- turtle.turnLeft()
- end
- for i=1, distance do
- CheckForStorage()
- CheckFuel()
- if turtle.getFuelLevel() < 10 then
- print("Waiting for fuel...")
- while turtle.getFuelLevel < 10 do
- CheckFuel()
- end
- print("Resuming.")
- end
- MineInFront()
- turtle.forward()
- MineLayer()
- end
- print("Mining complete!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement