Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cx = 0
- local cy = 0
- local cz = 0
- local objective = turtle.getFuelLimit()
- objective = objective - 300
- function clearConsole()
- term.clear()
- term.setCursorPos(1,1)
- end
- function fillAndDrink()
- turtle.placeDown()
- if turtle.getItemCount(1) == 0 then
- return false
- end
- turtle.select(1)
- turtle.refuel()
- clearConsole()
- print("----------")
- print("fuel: " .. turtle.getFuelLevel() .. "/" .. objective)
- print("----------")
- return true
- end
- function isDrinkable()
- local success, data = turtle.inspectDown()
- return not success or data.name == "minecraft:lava"
- end
- function findFloor()
- local originalY = cy
- while isDrinkable() and turtle.getFuelLevel() < objective do
- turtle.down()
- cy = cy - 1
- fillAndDrink()
- end
- while cy < originalY do
- turtle.up()
- cy = cy + 1
- end
- return turtle.getFuelLevel() >= objective
- end
- function line()
- local originalX = cx
- while cx < 50 and turtle.getFuelLevel() < objective do
- turtle.forward()
- cx = cx + 1
- if findFloor() then
- break
- end
- end
- while cx > originalX do
- turtle.back()
- cx = cx - 1
- end
- end
- function goBackToSpawn()
- while cx > 0 do
- turtle.back()
- cx = cx - 1
- end
- while cy > 0 do
- turtle.up()
- cy = cy + 1
- end
- while cz > 0 do
- turtle.back()
- cz = cz - 1
- end
- end
- while turtle.getFuelLevel() < objective do
- line()
- if cx > 25 then
- break
- end
- end
- goBackToSpawn()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement