mineflayer 4.9.0 → 4.10.1
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 +2 -0
- package/README.md +1 -1
- package/docs/README.md +1 -1
- package/docs/api.md +17 -12
- package/docs/history.md +9 -0
- package/index.d.ts +1 -1
- package/lib/plugins/blocks.js +5 -1
- package/lib/plugins/entities.js +2 -2
- package/lib/version.js +2 -2
- package/package.json +6 -6
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, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18 and 1.
|
|
20
|
+
* Supports Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20.
|
|
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, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18 and 1.
|
|
20
|
+
* Supports Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19 and 1.20.
|
|
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/api.md
CHANGED
|
@@ -422,21 +422,26 @@ The skin data is stored in the `skinData` property of the player object, if pres
|
|
|
422
422
|
|
|
423
423
|
See [prismarine-block](https://github.com/PrismarineJS/prismarine-block)
|
|
424
424
|
|
|
425
|
-
Also `block.blockEntity` is additional field with block entity data as `Object
|
|
425
|
+
Also `block.blockEntity` is additional field with block entity data as `Object`. The data in this varies between versions.
|
|
426
426
|
```js
|
|
427
|
-
// sign.blockEntity
|
|
427
|
+
// sign.blockEntity example from 1.19
|
|
428
428
|
{
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
Text3: { toString: Function }, // ChatMessage object
|
|
436
|
-
Text4: { toString: Function } // ChatMessage object
|
|
429
|
+
GlowingText: 0, // 0 for false, 1 for true
|
|
430
|
+
Color: 'black',
|
|
431
|
+
Text1: '{"text":"1"}',
|
|
432
|
+
Text2: '{"text":"2"}',
|
|
433
|
+
Text3: '{"text":"3"}',
|
|
434
|
+
Text4: '{"text":"4"}'
|
|
437
435
|
}
|
|
438
436
|
```
|
|
439
437
|
|
|
438
|
+
Note if you want to get a sign's plain text, you can use [`block.getSignText()`](https://github.com/PrismarineJS/prismarine-block/blob/master/doc/API.md#sign) instead of unstable blockEntity data.
|
|
439
|
+
```java
|
|
440
|
+
> block = bot.blockAt(new Vec3(0, 60, 0)) // assuming a sign is here
|
|
441
|
+
> block.getSignText()
|
|
442
|
+
[ "Front text\nHello world", "Back text\nHello world" ]
|
|
443
|
+
```
|
|
444
|
+
|
|
440
445
|
### Biome
|
|
441
446
|
|
|
442
447
|
See [prismarine-biome](https://github.com/PrismarineJS/prismarine-biome)
|
|
@@ -1803,9 +1808,9 @@ Set the direction your head is facing.
|
|
|
1803
1808
|
are looking, such as for dropping items or shooting arrows. This is not
|
|
1804
1809
|
needed for client-side calculation such as walking direction.
|
|
1805
1810
|
|
|
1806
|
-
#### bot.updateSign(block, text)
|
|
1811
|
+
#### bot.updateSign(block, text, back = false)
|
|
1807
1812
|
|
|
1808
|
-
Changes the text on the sign.
|
|
1813
|
+
Changes the text on the sign. On Minecraft 1.20 and newer, a truthy `back` will try setting the text on the back of a sign (only visible if not attached to a wall).
|
|
1809
1814
|
|
|
1810
1815
|
#### bot.equip(item, destination)
|
|
1811
1816
|
|
package/docs/history.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 4.10.1
|
|
2
|
+
|
|
3
|
+
* Fix attempting to access unloaded chunks (@frej4189)
|
|
4
|
+
|
|
5
|
+
## 4.10.0
|
|
6
|
+
|
|
7
|
+
* Fix handling for entities with unknown metadata (@extremeheat)
|
|
8
|
+
* support 1.20 (@PondWader)
|
|
9
|
+
|
|
1
10
|
## 4.9.0
|
|
2
11
|
|
|
3
12
|
* Fix bot not updating world height on respawn packet (@frej4189)
|
package/index.d.ts
CHANGED
|
@@ -275,7 +275,7 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
275
275
|
force?: boolean
|
|
276
276
|
) => Promise<void>
|
|
277
277
|
|
|
278
|
-
updateSign: (block: Block, text: string) => void
|
|
278
|
+
updateSign: (block: Block, text: string, back?: boolean) => void
|
|
279
279
|
|
|
280
280
|
equip: (
|
|
281
281
|
item: Item | number,
|
package/lib/plugins/blocks.js
CHANGED
|
@@ -413,17 +413,19 @@ function inject (bot, { version, storageBuilder, hideErrors }) {
|
|
|
413
413
|
bot._client.on('tile_entity_data', (packet) => {
|
|
414
414
|
if (packet.location !== undefined) {
|
|
415
415
|
const column = bot.world.getColumn(packet.location.x >> 4, packet.location.z >> 4)
|
|
416
|
+
if (!column) return
|
|
416
417
|
const pos = new Vec3(packet.location.x & 0xf, packet.location.y, packet.location.z & 0xf)
|
|
417
418
|
column.setBlockEntity(pos, packet.nbtData)
|
|
418
419
|
} else {
|
|
419
420
|
const tag = packet.nbtData
|
|
420
421
|
const column = bot.world.getColumn(tag.value.x.value >> 4, tag.value.z.value >> 4)
|
|
422
|
+
if (!column) return
|
|
421
423
|
const pos = new Vec3(tag.value.x.value & 0xf, tag.value.y.value, tag.value.z.value & 0xf)
|
|
422
424
|
column.setBlockEntity(pos, tag)
|
|
423
425
|
}
|
|
424
426
|
})
|
|
425
427
|
|
|
426
|
-
bot.updateSign = (block, text) => {
|
|
428
|
+
bot.updateSign = (block, text, back = false) => {
|
|
427
429
|
const lines = text.split('\n')
|
|
428
430
|
if (lines.length > 4) {
|
|
429
431
|
bot.emit('error', new Error('too many lines for sign text'))
|
|
@@ -452,8 +454,10 @@ function inject (bot, { version, storageBuilder, hideErrors }) {
|
|
|
452
454
|
text4: lines[3] ?? ''
|
|
453
455
|
}
|
|
454
456
|
}
|
|
457
|
+
|
|
455
458
|
bot._client.write('update_sign', {
|
|
456
459
|
location: block.position,
|
|
460
|
+
isFrontText: !back,
|
|
457
461
|
...signData
|
|
458
462
|
})
|
|
459
463
|
}
|
package/lib/plugins/entities.js
CHANGED
|
@@ -362,8 +362,8 @@ function inject (bot) {
|
|
|
362
362
|
bot.emit('entityUpdate', entity)
|
|
363
363
|
|
|
364
364
|
if (bot.supportFeature('mcDataHasEntityMetadata')) {
|
|
365
|
-
const
|
|
366
|
-
const metas = Object.fromEntries(packet.metadata.map(e => [metadataKeys[e.key], e.value]))
|
|
365
|
+
const metadataKeys = bot.registry.entitiesByName[entity.name]?.metadataKeys
|
|
366
|
+
const metas = metadataKeys ? Object.fromEntries(packet.metadata.map(e => [metadataKeys[e.key], e.value])) : {}
|
|
367
367
|
if (packet.metadata.some(m => m.type === 'item_stack')) {
|
|
368
368
|
bot.emit('itemDrop', entity)
|
|
369
369
|
}
|
package/lib/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
supportedVersions: ['1.8', '1.9', '1.10', '1.11', '1.12', '1.13', '1.14', '1.15', '1.16', '1.17', '1.18', '1.19'],
|
|
3
|
-
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']
|
|
2
|
+
supportedVersions: ['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'],
|
|
3
|
+
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']
|
|
4
4
|
} // when updating testedVersions, make sure to update CI.yml
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mineflayer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.1",
|
|
4
4
|
"description": "create minecraft bots with a stable, high level API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"minecraft-data": "^3.
|
|
25
|
-
"minecraft-protocol": "^1.
|
|
24
|
+
"minecraft-data": "^3.37.0",
|
|
25
|
+
"minecraft-protocol": "^1.43.1",
|
|
26
26
|
"prismarine-biome": "^1.1.1",
|
|
27
|
-
"prismarine-block": "^1.
|
|
27
|
+
"prismarine-block": "^1.17.0",
|
|
28
28
|
"prismarine-chat": "^1.7.1",
|
|
29
|
-
"prismarine-chunk": "^1.
|
|
29
|
+
"prismarine-chunk": "^1.34.0",
|
|
30
30
|
"prismarine-entity": "^2.2.0",
|
|
31
31
|
"prismarine-item": "^1.12.1",
|
|
32
32
|
"prismarine-nbt": "^2.0.0",
|
|
33
|
-
"prismarine-physics": "^1.
|
|
33
|
+
"prismarine-physics": "^1.7.0",
|
|
34
34
|
"prismarine-recipe": "^1.3.0",
|
|
35
35
|
"prismarine-registry": "^1.5.0",
|
|
36
36
|
"prismarine-windows": "^2.5.0",
|