Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SEPERATOR = "======================================="
- local BUCKET_ID = "minecraft:bucket"
- local FUELBUCKET_ID = "minecraft:lava_bucket"
- function MAIN()
- clear()
- welcomeMessage()
- untilSuccess(waitForBucket)
- clear()
- say(SEPERATOR)
- say("\nFueling up...\n")
- say(SEPERATOR)
- Refuel();
- clear()
- say(SEPERATOR)
- say("\nFinished.\n")
- say(SEPERATOR)
- end
- function clear() shell.run("clear"); end
- function say(...) print(...); end
- function untilSuccess(func,...)
- local s = false
- repeat s = func(...); until s;
- end
- function waitForBucket()
- turtle.select(1)
- local dat = turtle.getItemDetail()
- if not dat or dat.name ~= BUCKET_ID then say("Insert bucket in slot 1 to continue."); pause(); return false; end
- return true;
- end
- function pause()
- print("\nPress ENTER to continue...");
- local pX,pY = term.getCursorPos()
- --term.setCursorPos(0,0);
- io.read();
- clear()
- --term.setCursorPos(1,1)
- welcomeMessage();
- end
- function Refuel(dir)
- repeat
- turtle.select(1)
- turtle.placeDown()
- if turtle.refuel() then
- print("Fuel: "..tostring(turtle.getFuelLevel()).."...")
- end
- until turtle.getFuelLevel() >= turtle.getFuelLimit() - 100;
- end
- function welcomeMessage()
- say(SEPERATOR)
- say("Welcome to Turtle Refill!")
- say(SEPERATOR)
- end
- MAIN()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement