mineflayer 4.34.0 → 4.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -0
- package/README.md +1 -1
- package/docs/README.md +1 -1
- package/docs/history.md +5 -0
- package/docs/tutorial.md +2 -2
- package/lib/plugins/blocks.js +8 -2
- package/lib/plugins/chat.js +7 -0
- package/lib/plugins/physics.js +8 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/.github/workflows/ci.yml
CHANGED
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ First time using Node.js? You may want to start with the [tutorial](tutorial.md)
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
* Supports Minecraft 1.8 to 1.21.
|
|
20
|
+
* Supports Minecraft 1.8 to 1.21.11 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.21.9, 1.21.11) <!--version-->
|
|
21
21
|
* Entity knowledge and tracking.
|
|
22
22
|
* Block knowledge. You can query the world around you. Milliseconds to find any block.
|
|
23
23
|
* Physics and movement - handle all bounding boxes
|
package/docs/README.md
CHANGED
|
@@ -17,7 +17,7 @@ First time using Node.js? You may want to start with the [tutorial](tutorial.md)
|
|
|
17
17
|
|
|
18
18
|
## Features
|
|
19
19
|
|
|
20
|
-
* Supports Minecraft 1.8 to 1.21.
|
|
20
|
+
* Supports Minecraft 1.8 to 1.21.11 (1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21, 1.21.9, 1.21.11) <!--version-->
|
|
21
21
|
* Entity knowledge and tracking.
|
|
22
22
|
* Block knowledge. You can query the world around you. Milliseconds to find any block.
|
|
23
23
|
* Physics and movement - handle all bounding boxes
|
package/docs/history.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## 4.35.0
|
|
2
|
+
* [🎈 1.21.11 (#3781)](https://github.com/PrismarineJS/mineflayer/commit/597745c7c061943620fcacba7254bccee05b7a3e) (thanks @rom1504bot)
|
|
3
|
+
* [Fix chat pattern and event listener in tutorial (#3783)](https://github.com/PrismarineJS/mineflayer/commit/48586138f560991de60bea639c71fa82954cf50f) (thanks @brentspine)
|
|
4
|
+
* [Update history.md](https://github.com/PrismarineJS/mineflayer/commit/c9f766513d5bb5a93c5b86c07827128716c0afdb) (thanks @extremeheat)
|
|
5
|
+
|
|
1
6
|
## 4.34.0
|
|
2
7
|
* [🎈 1.21.9/1.21.10 support (#3754)](https://github.com/PrismarineJS/mineflayer/commit/f0afaf73061c15b67e5d3457b60ed543e711acb6) (thanks @rom1504bot)
|
|
3
8
|
* [Update russian docs (#3762)](https://github.com/PrismarineJS/mineflayer/commit/887b52b933d943c8d605d7835d6d55d198208fee) (thanks @fungoza)
|
package/docs/tutorial.md
CHANGED
|
@@ -576,8 +576,8 @@ Here we're creating a bot that answer 'hello' from the other player.
|
|
|
576
576
|
|
|
577
577
|
```js
|
|
578
578
|
bot.addChatPattern(
|
|
579
|
-
/(helo|hello|Hello)/,
|
|
580
579
|
'hello',
|
|
580
|
+
/(helo|hello|Hello)/,
|
|
581
581
|
'Someone says hello'
|
|
582
582
|
)
|
|
583
583
|
|
|
@@ -585,7 +585,7 @@ const hi = () => {
|
|
|
585
585
|
bot.chat('Hi!')
|
|
586
586
|
}
|
|
587
587
|
|
|
588
|
-
bot.on('hello', hi)
|
|
588
|
+
bot.on('chat:hello', hi)
|
|
589
589
|
```
|
|
590
590
|
|
|
591
591
|
#### Custom chat
|
package/lib/plugins/blocks.js
CHANGED
|
@@ -70,7 +70,7 @@ function inject (bot, { version, storageBuilder, hideErrors }) {
|
|
|
70
70
|
async function waitForChunksToLoad () {
|
|
71
71
|
const dist = 2
|
|
72
72
|
// This makes sure that the bot's real position has been already sent
|
|
73
|
-
if (!bot.entity.height) await onceWithCleanup(bot, 'chunkColumnLoad')
|
|
73
|
+
if (!bot.entity.height) await onceWithCleanup(bot, 'chunkColumnLoad', { timeout: 10000 })
|
|
74
74
|
const pos = bot.entity.position
|
|
75
75
|
const center = new Vec3(pos.x >> 4 << 4, 0, pos.z >> 4 << 4)
|
|
76
76
|
// get corner coords of 5x5 chunks around us
|
|
@@ -84,10 +84,16 @@ function inject (bot, { version, storageBuilder, hideErrors }) {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (chunkPosToCheck.size) {
|
|
87
|
-
return new Promise((resolve) => {
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
const timeout = setTimeout(() => {
|
|
89
|
+
bot.world.off('chunkColumnLoad', waitForLoadEvents)
|
|
90
|
+
reject(new Error(`Timeout waiting for ${chunkPosToCheck.size} chunks to load after 10000ms`))
|
|
91
|
+
}, 10000)
|
|
92
|
+
|
|
88
93
|
function waitForLoadEvents (columnCorner) {
|
|
89
94
|
chunkPosToCheck.delete(columnCorner.toString())
|
|
90
95
|
if (chunkPosToCheck.size === 0) { // no chunks left to find
|
|
96
|
+
clearTimeout(timeout)
|
|
91
97
|
bot.world.off('chunkColumnLoad', waitForLoadEvents) // remove this listener instance
|
|
92
98
|
resolve()
|
|
93
99
|
}
|
package/lib/plugins/chat.js
CHANGED
|
@@ -206,10 +206,17 @@ function inject (bot, options) {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
function awaitMessage (...args) {
|
|
209
|
+
const timeout = typeof args[args.length - 1] === 'number' ? args.pop() : 20000
|
|
209
210
|
return new Promise((resolve, reject) => {
|
|
210
211
|
const resolveMessages = args.flatMap(x => x)
|
|
212
|
+
const timeoutHandle = setTimeout(() => {
|
|
213
|
+
bot.off('messagestr', messageListener)
|
|
214
|
+
reject(new Error(`Timeout waiting for message after ${timeout}ms`))
|
|
215
|
+
}, timeout)
|
|
216
|
+
|
|
211
217
|
function messageListener (msg) {
|
|
212
218
|
if (resolveMessages.some(x => x instanceof RegExp ? x.test(msg) : msg === x)) {
|
|
219
|
+
clearTimeout(timeoutHandle)
|
|
213
220
|
resolve(msg)
|
|
214
221
|
bot.off('messagestr', messageListener)
|
|
215
222
|
}
|
package/lib/plugins/physics.js
CHANGED
|
@@ -427,10 +427,17 @@ function inject (bot, { physicsEnabled, maxCatchupTicks }) {
|
|
|
427
427
|
|
|
428
428
|
bot.waitForTicks = async function (ticks) {
|
|
429
429
|
if (ticks <= 0) return
|
|
430
|
-
await new Promise(resolve => {
|
|
430
|
+
await new Promise((resolve, reject) => {
|
|
431
|
+
// Assuming 20 ticks per second, add extra time for lag
|
|
432
|
+
const timeout = setTimeout(() => {
|
|
433
|
+
bot.removeListener('physicsTick', tickListener)
|
|
434
|
+
reject(new Error(`Timeout waiting for ${ticks} ticks after ${(ticks * 50 + 5000)}ms`))
|
|
435
|
+
}, ticks * 50 + 5000) // 50ms per tick + 5s buffer
|
|
436
|
+
|
|
431
437
|
const tickListener = () => {
|
|
432
438
|
ticks--
|
|
433
439
|
if (ticks === 0) {
|
|
440
|
+
clearTimeout(timeout)
|
|
434
441
|
bot.removeListener('physicsTick', tickListener)
|
|
435
442
|
resolve()
|
|
436
443
|
}
|
package/lib/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21.1', '1.21.3', '1.21.4', '1.21.5', '1.21.6', '1.21.8', '1.21.9']
|
|
1
|
+
const testedVersions = ['1.8.8', '1.9.4', '1.10.2', '1.11.2', '1.12.2', '1.13.2', '1.14.4', '1.15.2', '1.16.5', '1.17.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', '1.20.2', '1.20.4', '1.20.6', '1.21.1', '1.21.3', '1.21.4', '1.21.5', '1.21.6', '1.21.8', '1.21.9', '1.21.11']
|
|
2
2
|
module.exports = {
|
|
3
3
|
|
|
4
4
|
testedVersions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mineflayer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.35.0",
|
|
4
4
|
"description": "create minecraft bots with a stable, high level API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"minecraft-data": "^3.98.0",
|
|
25
|
-
"minecraft-protocol": "^1.
|
|
25
|
+
"minecraft-protocol": "^1.64.0",
|
|
26
26
|
"prismarine-biome": "^1.1.1",
|
|
27
27
|
"prismarine-block": "^1.22.0",
|
|
28
28
|
"prismarine-chat": "^1.7.1",
|