Download env/mineflayer/lib/utils.js from OpenCausaLab/ADAM: direct link, hf CLI and curl.
- Browser
- Download file 717 Bytes
-
https://huggingface.co/OpenCausaLab/ADAM/resolve/main/env/mineflayer/lib/utils.js
- Command line
-
hf download hf://OpenCausaLab/ADAM/env/mineflayer/lib/utils.js
-
curl -L -o utils.js https://huggingface.co/OpenCausaLab/ADAM/resolve/main/env/mineflayer/lib/utils.js
717 Bytes
| let gameTimeCounter = 0; | |
| let gameTimeList = []; | |
| const initCounter = (bot) => { | |
| gameTimeList = []; | |
| for (let i = 0; i < 13000; i += 1000) { | |
| gameTimeList.push(i); | |
| } | |
| for (let i = 13000; i < 24000; i += 2000) { | |
| gameTimeList.push(i); | |
| } | |
| const timeOfDay = bot.time.timeOfDay; | |
| for (let i = 0; i < gameTimeList.length; i++) { | |
| if (gameTimeList[i] > timeOfDay) { | |
| gameTimeCounter = i - 1; | |
| break; | |
| } | |
| } | |
| }; | |
| const getNextTime = () => { | |
| gameTimeCounter++; | |
| if (gameTimeCounter >= gameTimeList.length) { | |
| gameTimeCounter = 0; | |
| } | |
| return gameTimeList[gameTimeCounter]; | |
| }; | |
| module.exports = { | |
| initCounter, | |
| getNextTime, | |
| }; | |