mineflayer 4.3.0 → 4.5.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 +2 -0
- package/README.md +2 -2
- package/docs/README.md +2 -2
- package/docs/api.md +50 -20
- package/docs/es/api_es.md +1 -1
- package/docs/history.md +28 -0
- package/docs/ru/FAQ_RU.md +1 -1
- package/docs/ru/api_ru.md +2 -2
- package/docs/zh/README_ZH_CN.md +1 -1
- package/docs/zh/api.md +1 -1
- package/examples/anvil.js +4 -8
- package/examples/auto_totem.js +2 -3
- package/examples/block_entity.js +2 -7
- package/examples/blockfinder.js +2 -4
- package/examples/chatterbox.js +2 -3
- package/examples/chest.js +7 -12
- package/examples/collectblock.js +1 -7
- package/examples/command_block.js +1 -6
- package/examples/digger.js +1 -2
- package/examples/discord.js +1 -1
- package/examples/farmer.js +3 -8
- package/examples/fisherman.js +2 -7
- package/examples/graffiti.js +2 -7
- package/examples/guard.js +1 -2
- package/examples/inventory.js +4 -6
- package/examples/jumper.js +1 -1
- package/examples/pathfinder/gps.js +1 -2
- package/examples/place_end_crystal/index.js +2 -9
- package/examples/python/basic.py +1 -2
- package/examples/python/chatterbox.py +1 -1
- package/examples/trader.js +4 -8
- package/index.d.ts +23 -29
- package/lib/bossbar.js +2 -2
- package/lib/loader.js +2 -2
- package/lib/plugins/anvil.js +1 -1
- package/lib/plugins/bed.js +16 -1
- package/lib/plugins/block_actions.js +4 -3
- package/lib/plugins/blocks.js +3 -3
- package/lib/plugins/book.js +1 -1
- package/lib/plugins/boss_bar.js +1 -1
- package/lib/plugins/chat.js +63 -12
- package/lib/plugins/chest.js +6 -4
- package/lib/plugins/command_block.js +1 -1
- package/lib/plugins/craft.js +3 -3
- package/lib/plugins/creative.js +2 -2
- package/lib/plugins/entities.js +25 -8
- package/lib/plugins/game.js +14 -5
- package/lib/plugins/generic_place.js +1 -1
- package/lib/plugins/inventory.js +50 -25
- package/lib/plugins/place_entity.js +1 -1
- package/lib/plugins/ray_trace.js +36 -0
- package/lib/plugins/settings.js +1 -1
- package/lib/plugins/tablist.js +1 -1
- package/lib/plugins/team.js +1 -1
- package/lib/plugins/villager.js +9 -7
- package/lib/scoreboard.js +1 -1
- package/lib/team.js +2 -2
- package/lib/version.js +2 -2
- package/package.json +15 -16
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 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 and 1.19.
|
|
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
|
|
@@ -238,4 +238,4 @@ Run `npm run mocha_test -- -g <test_name>`, where `<test_name>` is a name of the
|
|
|
238
238
|
|
|
239
239
|
## License
|
|
240
240
|
|
|
241
|
-
[MIT](LICENSE)
|
|
241
|
+
[MIT](/LICENSE)
|
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 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 and 1.19.
|
|
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
|
|
@@ -238,4 +238,4 @@ Run `npm run mocha_test -- -g <test_name>`, where `<test_name>` is a name of the
|
|
|
238
238
|
|
|
239
239
|
## License
|
|
240
240
|
|
|
241
|
-
[MIT](LICENSE)
|
|
241
|
+
[MIT](/LICENSE)
|
package/docs/api.md
CHANGED
|
@@ -150,9 +150,9 @@
|
|
|
150
150
|
- [Events](#events)
|
|
151
151
|
- ["chat" (username, message, translate, jsonMsg, matches)](#chat-username-message-translate-jsonmsg-matches)
|
|
152
152
|
- ["whisper" (username, message, translate, jsonMsg, matches)](#whisper-username-message-translate-jsonmsg-matches)
|
|
153
|
-
- ["actionBar" (jsonMsg)](#actionbar-jsonmsg)
|
|
154
|
-
- ["message" (jsonMsg, position)](#message-jsonmsg-position)
|
|
155
|
-
- ["messagestr" (message, messagePosition, jsonMsg)](#messagestr-message-messageposition-jsonmsg)
|
|
153
|
+
- ["actionBar" (jsonMsg, verified)](#actionbar-jsonmsg-verified)
|
|
154
|
+
- ["message" (jsonMsg, position, sender, verified)](#message-jsonmsg-position-sender-verified)
|
|
155
|
+
- ["messagestr" (message, messagePosition, jsonMsg, sender, verified)](#messagestr-message-messageposition-jsonmsg-sender-verified)
|
|
156
156
|
- ["inject_allowed"](#inject_allowed)
|
|
157
157
|
- ["login"](#login)
|
|
158
158
|
- ["spawn"](#spawn)
|
|
@@ -209,8 +209,8 @@
|
|
|
209
209
|
- ["noteHeard" (block, instrument, pitch)](#noteheard-block-instrument-pitch)
|
|
210
210
|
- ["pistonMove" (block, isPulling, direction)](#pistonmove-block-ispulling-direction)
|
|
211
211
|
- ["chestLidMove" (block, isOpen, block2)](#chestlidmove-block-isopen-block2)
|
|
212
|
-
- ["blockBreakProgressObserved" (block, destroyStage)](#blockbreakprogressobserved-block-destroystage)
|
|
213
|
-
- ["blockBreakProgressEnd" (block)](#blockbreakprogressend-block)
|
|
212
|
+
- ["blockBreakProgressObserved" (block, destroyStage, entity)](#blockbreakprogressobserved-block-destroystage-entity)
|
|
213
|
+
- ["blockBreakProgressEnd" (block, entity)](#blockbreakprogressend-block-entity)
|
|
214
214
|
- ["diggingCompleted" (block)](#diggingcompleted-block)
|
|
215
215
|
- ["diggingAborted" (block)](#diggingaborted-block)
|
|
216
216
|
- ["move"](#move)
|
|
@@ -244,6 +244,7 @@
|
|
|
244
244
|
- [bot.waitForChunksToLoad()](#botwaitforchunkstoload)
|
|
245
245
|
- [bot.blockInSight(maxSteps, vectorLength)](#botblockinsightmaxsteps-vectorlength)
|
|
246
246
|
- [bot.blockAtCursor(maxDistance=256)](#botblockatcursormaxdistance256)
|
|
247
|
+
- [bot.entityAtCursor(maxDistance=3.5)](#botentityatcursormaxdistance35)
|
|
247
248
|
- [bot.blockAtEntityCursor(entity=bot.entity, maxDistance=256)](#botblockatentitycursorentitybotentity-maxdistance256)
|
|
248
249
|
- [bot.canSeeBlock(block)](#botcanseeblockblock)
|
|
249
250
|
- [bot.findBlocks(options)](#botfindblocksoptions)
|
|
@@ -288,7 +289,7 @@
|
|
|
288
289
|
- [bot.denyResourcePack()](#botdenyresourcepack)
|
|
289
290
|
- [bot.placeBlock(referenceBlock, faceVector)](#botplaceblockreferenceblock-facevector)
|
|
290
291
|
- [bot.placeEntity(referenceBlock, faceVector)](#botplaceentityreferenceblock-facevector)
|
|
291
|
-
- [bot.activateBlock(block)](#botactivateblockblock)
|
|
292
|
+
- [bot.activateBlock(block, direction?: Vec3, cursorPos?: Vec3)](#botactivateblockblock-direction-vec3-cursorpos-vec3)
|
|
292
293
|
- [bot.activateEntity(entity)](#botactivateentityentity)
|
|
293
294
|
- [bot.activateEntityAt(entity, position)](#botactivateentityatentity-position)
|
|
294
295
|
- [bot.consume()](#botconsume)
|
|
@@ -304,8 +305,8 @@
|
|
|
304
305
|
- [bot.setQuickBarSlot(slot)](#botsetquickbarslotslot)
|
|
305
306
|
- [bot.craft(recipe, count, craftingTable)](#botcraftrecipe-count-craftingtable)
|
|
306
307
|
- [bot.writeBook(slot, pages)](#botwritebookslot-pages)
|
|
307
|
-
- [bot.openContainer(containerBlock or containerEntity)](#botopencontainercontainerblock-or-containerentity)
|
|
308
|
-
- [bot.openChest(chestBlock or minecartchestEntity)](#botopenchestchestblock-or-minecartchestentity)
|
|
308
|
+
- [bot.openContainer(containerBlock or containerEntity, direction?, cursorPos?)](#botopencontainercontainerblock-or-containerentity-direction-cursorpos)
|
|
309
|
+
- [bot.openChest(chestBlock or minecartchestEntity, direction?, cursorPos?)](#botopenchestchestblock-or-minecartchestentity-direction-cursorpos)
|
|
309
310
|
- [bot.openFurnace(furnaceBlock)](#botopenfurnacefurnaceblock)
|
|
310
311
|
- [bot.openDispenser(dispenserBlock)](#botopendispenserdispenserblock)
|
|
311
312
|
- [bot.openEnchantmentTable(enchantmentTableBlock)](#botopenenchantmenttableenchantmenttableblock)
|
|
@@ -321,7 +322,7 @@
|
|
|
321
322
|
- [bot.putAway(slot)](#botputawayslot)
|
|
322
323
|
- [bot.closeWindow(window)](#botclosewindowwindow)
|
|
323
324
|
- [bot.transfer(options)](#bottransferoptions)
|
|
324
|
-
- [bot.openBlock(block)](#botopenblockblock)
|
|
325
|
+
- [bot.openBlock(block, direction?: Vec3, cursorPos?: Vec3)](#botopenblockblock-direction-vec3-cursorpos-vec3)
|
|
325
326
|
- [bot.openEntity(entity)](#botopenentityentity)
|
|
326
327
|
- [bot.moveSlotItem(sourceSlot, destSlot)](#botmoveslotitemsourceslot-destslot)
|
|
327
328
|
- [bot.updateHeldItem()](#botupdatehelditem)
|
|
@@ -453,7 +454,7 @@ See [prismarine-recipe](https://github.com/PrismarineJS/prismarine-recipe)
|
|
|
453
454
|
### mineflayer.Container
|
|
454
455
|
|
|
455
456
|
Extends windows.Window for chests, dispensers, etc...
|
|
456
|
-
See `bot.
|
|
457
|
+
See `bot.openContainer(chestBlock or minecartchestEntity)`.
|
|
457
458
|
|
|
458
459
|
### mineflayer.Furnace
|
|
459
460
|
|
|
@@ -1105,13 +1106,14 @@ Only emitted when a player chats to you privately.
|
|
|
1105
1106
|
* `jsonMsg` - unmodified JSON message from the server
|
|
1106
1107
|
* `matches` - array of returned matches from regular expressions. May be null
|
|
1107
1108
|
|
|
1108
|
-
#### "actionBar" (jsonMsg)
|
|
1109
|
+
#### "actionBar" (jsonMsg, verified)
|
|
1109
1110
|
|
|
1110
1111
|
Emitted for every server message which appears on the Action Bar.
|
|
1111
1112
|
|
|
1112
1113
|
* `jsonMsg` - unmodified JSON message from the server
|
|
1114
|
+
* `verified` -> null if non signed, true if signed and correct, false if signed and incorrect
|
|
1113
1115
|
|
|
1114
|
-
#### "message" (jsonMsg, position)
|
|
1116
|
+
#### "message" (jsonMsg, position, sender, verified)
|
|
1115
1117
|
|
|
1116
1118
|
Emitted for every server message, including chats.
|
|
1117
1119
|
|
|
@@ -1122,10 +1124,18 @@ Emitted for every server message, including chats.
|
|
|
1122
1124
|
* system
|
|
1123
1125
|
* game_info
|
|
1124
1126
|
|
|
1125
|
-
|
|
1127
|
+
* `sender` - UUID of sender if known (1.16+), else null
|
|
1128
|
+
|
|
1129
|
+
* `verified` -> null if non signed, true if signed and correct, false if signed and incorrect
|
|
1130
|
+
|
|
1131
|
+
#### "messagestr" (message, messagePosition, jsonMsg, sender, verified)
|
|
1126
1132
|
|
|
1127
1133
|
Alias for the "message" event but it calls .toString() on the message object to get a string for the message before emitting.
|
|
1128
1134
|
|
|
1135
|
+
* `sender` - UUID of sender if known (1.16+), else null
|
|
1136
|
+
|
|
1137
|
+
* `verified` -> null if non signed, true if signed and correct, false if signed and incorrect
|
|
1138
|
+
|
|
1129
1139
|
#### "inject_allowed"
|
|
1130
1140
|
Fires when the index file has been loaded, you can load mcData and plugins here but it's better to wait for "spawn" event.
|
|
1131
1141
|
|
|
@@ -1321,19 +1331,21 @@ Fires when a note block goes off somewhere.
|
|
|
1321
1331
|
* `isOpen`: number of players that have the chest open. 0 if it's closed
|
|
1322
1332
|
* `block2`: a Block instance, the other half of the block whose lid opened. null if it's not a double chest
|
|
1323
1333
|
|
|
1324
|
-
#### "blockBreakProgressObserved" (block, destroyStage)
|
|
1334
|
+
#### "blockBreakProgressObserved" (block, destroyStage, entity)
|
|
1325
1335
|
|
|
1326
1336
|
Fires when the client observes a block in the process of being broken.
|
|
1327
1337
|
|
|
1328
1338
|
* `block`: a Block instance, the block being broken
|
|
1329
1339
|
* `destroyStage`: integer corresponding to the destroy progress (0-9)
|
|
1340
|
+
* `entity`: the entity which is breaking the block.
|
|
1330
1341
|
|
|
1331
|
-
#### "blockBreakProgressEnd" (block)
|
|
1342
|
+
#### "blockBreakProgressEnd" (block, entity)
|
|
1332
1343
|
|
|
1333
1344
|
Fires when the client observes a block stops being broken.
|
|
1334
1345
|
This occurs whether the process was completed or aborted.
|
|
1335
1346
|
|
|
1336
1347
|
* `block`: a Block instance, the block no longer being broken
|
|
1348
|
+
* `entity`: the entity which has stopped breaking the block
|
|
1337
1349
|
|
|
1338
1350
|
#### "diggingCompleted" (block)
|
|
1339
1351
|
|
|
@@ -1477,6 +1489,11 @@ Returns the block at which bot is looking at or `null`
|
|
|
1477
1489
|
Returns the block at which bot is looking at or `null`
|
|
1478
1490
|
* `maxDistance` - The maximum distance the block can be from the eye, defaults to 256.
|
|
1479
1491
|
|
|
1492
|
+
#### bot.entityAtCursor(maxDistance=3.5)
|
|
1493
|
+
|
|
1494
|
+
Returns the entity at which bot is looking at or `null`
|
|
1495
|
+
* `maxDistance` - The maximum distance the entity can be from the eye, defaults to 3.5.
|
|
1496
|
+
|
|
1480
1497
|
#### bot.blockAtEntityCursor(entity=bot.entity, maxDistance=256)
|
|
1481
1498
|
|
|
1482
1499
|
Returns the block at which specific entity is looking at or `null`
|
|
@@ -1820,13 +1837,15 @@ This function returns a `Promise`, with `Entity` as its argument upon completion
|
|
|
1820
1837
|
|
|
1821
1838
|
The new block will be placed at `referenceBlock.position.plus(faceVector)`.
|
|
1822
1839
|
|
|
1823
|
-
#### bot.activateBlock(block)
|
|
1840
|
+
#### bot.activateBlock(block, direction?: Vec3, cursorPos?: Vec3)
|
|
1824
1841
|
|
|
1825
1842
|
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1826
1843
|
|
|
1827
1844
|
Punch a note block, open a door, etc.
|
|
1828
1845
|
|
|
1829
1846
|
* `block` - the block to activate
|
|
1847
|
+
* `direction` Optional defaults to `new Vec3(0, 1, 0)` (up). A vector off the direction the container block should be interacted with. Does nothing when a container entity is targeted.
|
|
1848
|
+
* `cursorPos` Optional defaults to `new Vec3(0.5, 0.5, 0.5)` (block center). The curos position when opening the block instance. This is send with the activate block packet. Does nothing when a container entity is targeted.
|
|
1830
1849
|
|
|
1831
1850
|
#### bot.activateEntity(entity)
|
|
1832
1851
|
|
|
@@ -1927,11 +1946,16 @@ This function returns a `Promise`, with `void` as its argument when the writing
|
|
|
1927
1946
|
* `slot` is in inventory window coordinates (where 36 is the first quickbar slot, etc.).
|
|
1928
1947
|
* `pages` is an array of strings represents the pages.
|
|
1929
1948
|
|
|
1930
|
-
#### bot.openContainer(containerBlock or containerEntity)
|
|
1949
|
+
#### bot.openContainer(containerBlock or containerEntity, direction?, cursorPos?)
|
|
1950
|
+
Opens a block container or entity.
|
|
1951
|
+
|
|
1952
|
+
* `containerBlock` or `containerEntity` The block instance to open or the entity to open.
|
|
1953
|
+
* `direction` Optional defaults to `new Vec3(0, 1, 0)` (up). A vector off the direction the container block should be interacted with. Does nothing when a container entity is targeted.
|
|
1954
|
+
* `cursorPos` Optional defaults to `new Vec3(0.5, 0.5, 0.5)` (block center). The curos position when opening the block instance. This is send with the activate block packet. Does nothing when a container entity is targeted.
|
|
1931
1955
|
|
|
1932
1956
|
Returns a promise on a `Container` instance which represents the container you are opening.
|
|
1933
1957
|
|
|
1934
|
-
#### bot.openChest(chestBlock or minecartchestEntity)
|
|
1958
|
+
#### bot.openChest(chestBlock or minecartchestEntity, direction?, cursorPos?)
|
|
1935
1959
|
|
|
1936
1960
|
Deprecated. Same as `openContainer`
|
|
1937
1961
|
|
|
@@ -1995,9 +2019,13 @@ These are lower level methods for the inventory, they can be useful sometimes bu
|
|
|
1995
2019
|
#### bot.clickWindow(slot, mouseButton, mode)
|
|
1996
2020
|
|
|
1997
2021
|
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2022
|
+
|
|
2023
|
+
The only valid mode option at the moment is 0. Shift clicking or mouse draging is not implemented.
|
|
1998
2024
|
|
|
1999
2025
|
Click on the current window. See details at https://wiki.vg/Protocol#Click_Window
|
|
2000
2026
|
|
|
2027
|
+
Prefer using bot.simpleClick.*
|
|
2028
|
+
|
|
2001
2029
|
#### bot.putSelectedItemRange(start, end, window, slot)
|
|
2002
2030
|
|
|
2003
2031
|
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
@@ -2028,11 +2056,13 @@ Transfer some kind of item from one range to an other. `options` is an object co
|
|
|
2028
2056
|
* `count` : the amount of items to transfer. Default: `1`
|
|
2029
2057
|
* `nbt` : nbt data of the item to transfer. Default: `nullish` (ignores nbt)
|
|
2030
2058
|
|
|
2031
|
-
#### bot.openBlock(block)
|
|
2059
|
+
#### bot.openBlock(block, direction?: Vec3, cursorPos?: Vec3)
|
|
2032
2060
|
|
|
2033
2061
|
Open a block, for example a chest, returns a promise on the opening `Window`.
|
|
2034
2062
|
|
|
2035
|
-
* `block` is the block the bot will open
|
|
2063
|
+
* `block` is the block the bot will open.
|
|
2064
|
+
* `direction` Optional defaults to `new Vec3(0, 1, 0)` (up). A vector off the direction the container block should be interacted with. Does nothing when a container entity is targeted.
|
|
2065
|
+
* `cursorPos` Optional defaults to `new Vec3(0.5, 0.5, 0.5)` (block center). The curos position when opening the block instance. This is send with the activate block packet. Does nothing when a container entity is targeted.
|
|
2036
2066
|
|
|
2037
2067
|
#### bot.openEntity(entity)
|
|
2038
2068
|
|
package/docs/es/api_es.md
CHANGED
|
@@ -423,7 +423,7 @@ Mira [prismarine-recipe](https://github.com/PrismarineJS/prismarine-recipe)
|
|
|
423
423
|
### mineflayer.Container
|
|
424
424
|
|
|
425
425
|
Extiende windows.Window para cofres, dispensadores, etc...
|
|
426
|
-
Mira `bot.
|
|
426
|
+
Mira `bot.openContainer(chestBlock o minecartchestEntity)`.
|
|
427
427
|
|
|
428
428
|
### mineflayer.Furnace
|
|
429
429
|
|
package/docs/history.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## 4.5.0
|
|
2
|
+
|
|
3
|
+
* 1.19 support (@extremeheat @rom1504 @FCKJohni @Shorent)
|
|
4
|
+
* refactoring examples to use bot.registry (@Epirito)
|
|
5
|
+
* Added barrel and coloured shulker boxes to openable windows (@lazydancer)
|
|
6
|
+
* types: Fix return type for openBlock and openEntity (@sefirosweb)
|
|
7
|
+
* Update activateEntity and activateEntityAt types (@amoraschi)
|
|
8
|
+
|
|
9
|
+
## 4.4.0
|
|
10
|
+
|
|
11
|
+
* Fix chatterbox example not getting dropped item (@u9g) [commit](https://github.com/PrismarineJS/mineflayer/commit/f860eac01a0418f4a3de749482d8cab681acc48a)
|
|
12
|
+
* Fix 404d link to license (@BalaM314) [#2601](https://github.com/PrismarineJS/mineflayer/pull/2601)
|
|
13
|
+
* Add bot.clickWindow mode disclaimer (@IceTank) [#2595](https://github.com/PrismarineJS/mineflayer/pull/2595)
|
|
14
|
+
* Add spectator to GameMode types (@IceTank) [#2627](https://github.com/PrismarineJS/mineflayer/pull/2627)
|
|
15
|
+
* Update types for isABed (@amoraschi) [#2628](https://github.com/PrismarineJS/mineflayer/pull/2628)
|
|
16
|
+
* Replace openChest with openContainer in docs and examples (@slightly-imperfect) [#2656](https://github.com/PrismarineJS/mineflayer/pull/2656)
|
|
17
|
+
* Add ender chests as a chest type (@RoseChilds) [#2642](https://github.com/PrismarineJS/mineflayer/pull/2642)
|
|
18
|
+
* Added method to wait until sleep function is in reality sleeping (@sefirosweb) [#2617](https://github.com/PrismarineJS/mineflayer/pull/2617)
|
|
19
|
+
* Added type on move event (@sefirosweb) [#2712](https://github.com/PrismarineJS/mineflayer/pull/2712)
|
|
20
|
+
* Added thunderState type (@sefirosweb) [#2711](https://github.com/PrismarineJS/mineflayer/pull/2711)
|
|
21
|
+
* Fix type error on chest open (@IceTank) [#2684](https://github.com/PrismarineJS/mineflayer/pull/2684)
|
|
22
|
+
* Add support for repeating and chain command blocks. (@mirkokral) [#2669](https://github.com/PrismarineJS/mineflayer/pull/2669)
|
|
23
|
+
* Add player object to blockBreakProgressEnd & observed. (@JackCrispy) [#2647](https://github.com/PrismarineJS/mineflayer/pull/2647)
|
|
24
|
+
* Add entity to blockBreakProgress (@JackCrispy ) [#2648](https://github.com/PrismarineJS/mineflayer/pull/2648)
|
|
25
|
+
* Add direction support to activateBlock, openBlock (@IceTank) [#2039](https://github.com/PrismarineJS/mineflayer/pull/2039)
|
|
26
|
+
* Add entityAtCursor function (@O-of) [#2077](https://github.com/PrismarineJS/mineflayer/pull/2077)
|
|
27
|
+
* Fix regex dos (@IceTank) [#2350](https://github.com/PrismarineJS/mineflayer/pull/2350)
|
|
28
|
+
|
|
1
29
|
## 4.3.0
|
|
2
30
|
|
|
3
31
|
* Cache 'positionUpdateSentEveryTick' feature lookup (@IceTank)
|
package/docs/ru/FAQ_RU.md
CHANGED
|
@@ -54,7 +54,7 @@ function getLore (item) {
|
|
|
54
54
|
if (item.nbt == null) return message
|
|
55
55
|
|
|
56
56
|
const nbt = require('prismarine-nbt')
|
|
57
|
-
const ChatMessage = require('prismarine-chat')(bot.
|
|
57
|
+
const ChatMessage = require('prismarine-chat')(bot.registry)
|
|
58
58
|
|
|
59
59
|
const data = nbt.simplify(item.nbt)
|
|
60
60
|
const display = data.display
|
package/docs/ru/api_ru.md
CHANGED
|
@@ -368,7 +368,7 @@
|
|
|
368
368
|
### mineflayer.Chest
|
|
369
369
|
|
|
370
370
|
Предоставляет сеанс взаимодействия с сундуками ( Открытие и закрытие )
|
|
371
|
-
Смотрите `bot.
|
|
371
|
+
Смотрите `bot.openContainer(chestBlock or minecartchestEntity)`.
|
|
372
372
|
|
|
373
373
|
#### chest.window
|
|
374
374
|
|
|
@@ -1490,7 +1490,7 @@ bot.once('login', () => {
|
|
|
1490
1490
|
|
|
1491
1491
|
#### bot.openChest(chestBlock or minecartchestEntity)
|
|
1492
1492
|
|
|
1493
|
-
|
|
1493
|
+
Устарело.Открывает сундук. Такой же как "openContainer"
|
|
1494
1494
|
|
|
1495
1495
|
#### bot.openFurnace(furnaceBlock)
|
|
1496
1496
|
|
package/docs/zh/README_ZH_CN.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://gitpod.io/#https://github.com/PrismarineJS/mineflayer)
|
|
11
11
|
[](https://colab.research.google.com/github/PrismarineJS/mineflayer/blob/master/docs/mineflayer.ipynb)
|
|
12
12
|
|
|
13
|
-
| <sub>EN</sub> [English](README.md) | <sub>RU</sub> [русский](ru/README_RU.md) | <sub>ES</sub> [Español](es/README_ES.md) | <sub>FR</sub> [Français](fr/README_FR.md) | <sub>TR</sub> [Türkçe](tr/README_TR.md) | <sub>ZH</sub> [中文](zh/README_ZH_CN.md)
|
|
13
|
+
| <sub>EN</sub> [English](../README.md) | <sub>RU</sub> [русский](../ru/README_RU.md) | <sub>ES</sub> [Español](../es/README_ES.md) | <sub>FR</sub> [Français](../fr/README_FR.md) | <sub>TR</sub> [Türkçe](../tr/README_TR.md) | <sub>ZH</sub> [中文](../zh/README_ZH_CN.md)
|
|
14
14
|
|-------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|
|
|
15
15
|
|
|
16
16
|
使用强大、稳定、高级的JavaScript [API](../api.md) 来开发Minecraft机器人,同时支持 Python。
|
package/docs/zh/api.md
CHANGED
|
@@ -446,7 +446,7 @@ See [prismarine-recipe](https://github.com/PrismarineJS/prismarine-recipe)
|
|
|
446
446
|
### mineflayer.Container
|
|
447
447
|
|
|
448
448
|
Extends windows.Window for chests, dispensers, etc...
|
|
449
|
-
See `bot.
|
|
449
|
+
See `bot.openContainer(chestBlock or minecartchestEntity)`.
|
|
450
450
|
|
|
451
451
|
### mineflayer.Furnace
|
|
452
452
|
|
package/examples/anvil.js
CHANGED
|
@@ -29,10 +29,6 @@ const bot = mineflayer.createBot({
|
|
|
29
29
|
password: process.argv[5]
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
let mcData
|
|
33
|
-
|
|
34
|
-
bot.on('spawn', () => { mcData = require('minecraft-data')(bot.version) })
|
|
35
|
-
|
|
36
32
|
bot.on('chat', async (username, message) => {
|
|
37
33
|
const command = message.split(' ')
|
|
38
34
|
|
|
@@ -105,10 +101,10 @@ function sayItems (items = bot.inventory.items()) {
|
|
|
105
101
|
}
|
|
106
102
|
|
|
107
103
|
function getAnvilIds () {
|
|
108
|
-
const matchingBlocks = [
|
|
109
|
-
if (
|
|
110
|
-
matchingBlocks.push(
|
|
111
|
-
matchingBlocks.push(
|
|
104
|
+
const matchingBlocks = [bot.registry.blocksByName.anvil.id]
|
|
105
|
+
if (bot.registry.blocksByName?.chipped_anvil) {
|
|
106
|
+
matchingBlocks.push(bot.registry.blocksByName.chipped_anvil.id)
|
|
107
|
+
matchingBlocks.push(bot.registry.blocksByName.damaged_anvil.id)
|
|
112
108
|
}
|
|
113
109
|
return matchingBlocks
|
|
114
110
|
}
|
package/examples/auto_totem.js
CHANGED
|
@@ -17,9 +17,8 @@ const bot = mineflayer.createBot({
|
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
bot.on('spawn', () => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
if (mcData.itemsByName.totem_of_undying) {
|
|
20
|
+
const totemId = bot.registry.itemsByName.totem_of_undying.id // Get the correct id
|
|
21
|
+
if (bot.registry.itemsByName.totem_of_undying) {
|
|
23
22
|
setInterval(() => {
|
|
24
23
|
const totem = bot.inventory.findInventoryItem(totemId, null)
|
|
25
24
|
if (totem) {
|
package/examples/block_entity.js
CHANGED
|
@@ -16,11 +16,6 @@ const bot = mineflayer.createBot({
|
|
|
16
16
|
password: process.argv[5]
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
let mcData
|
|
20
|
-
bot.on('inject_allowed', () => {
|
|
21
|
-
mcData = require('minecraft-data')(bot.version)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
19
|
bot.on('message', (cm) => {
|
|
25
20
|
if (cm.toString().includes('spawner')) {
|
|
26
21
|
spawner()
|
|
@@ -30,9 +25,9 @@ bot.on('message', (cm) => {
|
|
|
30
25
|
function spawner () {
|
|
31
26
|
let blockName
|
|
32
27
|
if (bot.supportFeature('mobSpawner')) {
|
|
33
|
-
blockName =
|
|
28
|
+
blockName = bot.registry.blocksByName.mob_spawner.id
|
|
34
29
|
} else if (bot.supportFeature('spawner')) {
|
|
35
|
-
blockName =
|
|
30
|
+
blockName = bot.registry.blocksByName.spawner.id
|
|
36
31
|
}
|
|
37
32
|
const block = bot.findBlock({
|
|
38
33
|
matching: blockName,
|
package/examples/blockfinder.js
CHANGED
|
@@ -20,8 +20,6 @@ const bot = mineflayer.createBot({
|
|
|
20
20
|
bot.on('chat', async (username, message) => {
|
|
21
21
|
if (username === bot.username) return
|
|
22
22
|
|
|
23
|
-
const mcData = require('minecraft-data')(bot.version)
|
|
24
|
-
|
|
25
23
|
if (message === 'loaded') {
|
|
26
24
|
console.log(bot.entity.position)
|
|
27
25
|
await bot.waitForChunksToLoad()
|
|
@@ -30,11 +28,11 @@ bot.on('chat', async (username, message) => {
|
|
|
30
28
|
|
|
31
29
|
if (message.startsWith('find')) {
|
|
32
30
|
const name = message.split(' ')[1]
|
|
33
|
-
if (
|
|
31
|
+
if (bot.registry.blocksByName[name] === undefined) {
|
|
34
32
|
bot.chat(`${name} is not a block name`)
|
|
35
33
|
return
|
|
36
34
|
}
|
|
37
|
-
const ids = [
|
|
35
|
+
const ids = [bot.registry.blocksByName[name].id]
|
|
38
36
|
|
|
39
37
|
const startTime = performance.now()
|
|
40
38
|
const blocks = bot.findBlocks({ matching: ids, maxDistance: 128, count: 10 })
|
package/examples/chatterbox.js
CHANGED
|
@@ -168,9 +168,8 @@ bot.on('playerLeft', (player) => {
|
|
|
168
168
|
bot.chat(`Bye ${player.username}`)
|
|
169
169
|
})
|
|
170
170
|
bot.on('playerCollect', (collector, collected) => {
|
|
171
|
-
if (collector.type === 'player'
|
|
172
|
-
const
|
|
173
|
-
const item = mineflayer.Item.fromNotch(rawItem)
|
|
171
|
+
if (collector.type === 'player') {
|
|
172
|
+
const item = collected.getDroppedItem()
|
|
174
173
|
bot.chat(`${collector.username !== bot.username ? ("I'm so jealous. " + collector.username) : 'I '} collected ${item.count} ${item.displayName}`)
|
|
175
174
|
}
|
|
176
175
|
})
|
package/examples/chest.js
CHANGED
|
@@ -33,11 +33,6 @@ const bot = mineflayer.createBot({
|
|
|
33
33
|
password: process.argv[5]
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
let mcData
|
|
37
|
-
bot.once('inject_allowed', () => {
|
|
38
|
-
mcData = require('minecraft-data')(bot.version)
|
|
39
|
-
})
|
|
40
|
-
|
|
41
36
|
bot.on('experience', () => {
|
|
42
37
|
bot.chat(`I am level ${bot.experience.level}`)
|
|
43
38
|
})
|
|
@@ -86,7 +81,7 @@ async function watchChest (minecart, blocks = []) {
|
|
|
86
81
|
let chestToOpen
|
|
87
82
|
if (minecart) {
|
|
88
83
|
chestToOpen = Object.keys(bot.entities)
|
|
89
|
-
.map(id => bot.entities[id]).find(e => e.entityType ===
|
|
84
|
+
.map(id => bot.entities[id]).find(e => e.entityType === bot.registry.entitiesByName.chest_minecart &&
|
|
90
85
|
e.objectData.intField === 1 &&
|
|
91
86
|
bot.entity.position.distanceTo(e.position) < 3)
|
|
92
87
|
if (!chestToOpen) {
|
|
@@ -95,7 +90,7 @@ async function watchChest (minecart, blocks = []) {
|
|
|
95
90
|
}
|
|
96
91
|
} else {
|
|
97
92
|
chestToOpen = bot.findBlock({
|
|
98
|
-
matching: blocks.map(name =>
|
|
93
|
+
matching: blocks.map(name => bot.registry.blocksByName[name].id),
|
|
99
94
|
maxDistance: 6
|
|
100
95
|
})
|
|
101
96
|
if (!chestToOpen) {
|
|
@@ -103,7 +98,7 @@ async function watchChest (minecart, blocks = []) {
|
|
|
103
98
|
return
|
|
104
99
|
}
|
|
105
100
|
}
|
|
106
|
-
const chest = await bot.
|
|
101
|
+
const chest = await bot.openContainer(chestToOpen)
|
|
107
102
|
sayItems(chest.containerItems())
|
|
108
103
|
chest.on('updateSlot', (slot, oldItem, newItem) => {
|
|
109
104
|
bot.chat(`chest update: ${itemToString(oldItem)} -> ${itemToString(newItem)} (slot: ${slot})`)
|
|
@@ -170,7 +165,7 @@ async function watchChest (minecart, blocks = []) {
|
|
|
170
165
|
|
|
171
166
|
async function watchFurnace () {
|
|
172
167
|
const furnaceBlock = bot.findBlock({
|
|
173
|
-
matching: ['furnace', 'lit_furnace'].filter(name =>
|
|
168
|
+
matching: ['furnace', 'lit_furnace'].filter(name => bot.registry.blocksByName[name] !== undefined).map(name => bot.registry.blocksByName[name].id),
|
|
174
169
|
maxDistance: 6
|
|
175
170
|
})
|
|
176
171
|
if (!furnaceBlock) {
|
|
@@ -256,7 +251,7 @@ async function watchFurnace () {
|
|
|
256
251
|
|
|
257
252
|
async function watchEnchantmentTable () {
|
|
258
253
|
const enchantTableBlock = bot.findBlock({
|
|
259
|
-
matching: ['enchanting_table'].map(name =>
|
|
254
|
+
matching: ['enchanting_table'].map(name => bot.registry.blocksByName[name].id),
|
|
260
255
|
maxDistance: 6
|
|
261
256
|
})
|
|
262
257
|
if (!enchantTableBlock) {
|
|
@@ -322,8 +317,8 @@ async function watchEnchantmentTable () {
|
|
|
322
317
|
}
|
|
323
318
|
|
|
324
319
|
async function addLapis () {
|
|
325
|
-
const item = itemByType(table.window.items(), ['dye', 'purple_dye', 'lapis_lazuli'].filter(name =>
|
|
326
|
-
.map(name =>
|
|
320
|
+
const item = itemByType(table.window.items(), ['dye', 'purple_dye', 'lapis_lazuli'].filter(name => bot.registry.itemByName[name] !== undefined)
|
|
321
|
+
.map(name => bot.registry.itemByName[name].id))
|
|
327
322
|
if (item) {
|
|
328
323
|
try {
|
|
329
324
|
await table.putLapis(item)
|
package/examples/collectblock.js
CHANGED
|
@@ -26,19 +26,13 @@ const bot = mineflayer.createBot({
|
|
|
26
26
|
bot.loadPlugin(pathfinder)
|
|
27
27
|
bot.loadPlugin(collectBlock)
|
|
28
28
|
|
|
29
|
-
// Load mc data
|
|
30
|
-
let mcData
|
|
31
|
-
bot.once('spawn', () => {
|
|
32
|
-
mcData = require('minecraft-data')(bot.version)
|
|
33
|
-
})
|
|
34
|
-
|
|
35
29
|
// Listen for when a player says "collect [something]" in chat
|
|
36
30
|
bot.on('chat', (username, message) => {
|
|
37
31
|
const args = message.split(' ')
|
|
38
32
|
if (args[0] !== 'collect') return
|
|
39
33
|
|
|
40
34
|
// Get the correct block type
|
|
41
|
-
const blockType =
|
|
35
|
+
const blockType = bot.registry.blocksByName[args[1]]
|
|
42
36
|
if (!blockType) {
|
|
43
37
|
bot.chat("I don't know any blocks with that name.")
|
|
44
38
|
return
|
|
@@ -16,18 +16,13 @@ const bot = mineflayer.createBot({
|
|
|
16
16
|
password: process.argv[5]
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
let mcData
|
|
20
|
-
bot.once('inject_allowed', () => {
|
|
21
|
-
mcData = require('minecraft-data')(bot.version)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
19
|
bot.on('chat', (username, message) => {
|
|
25
20
|
if (username === bot.username) return
|
|
26
21
|
const command = message.split(' ')
|
|
27
22
|
switch (true) {
|
|
28
23
|
case /^setCommandBlock (.+)$/.test(message): {
|
|
29
24
|
const commandBlock = bot.findBlock({
|
|
30
|
-
matching:
|
|
25
|
+
matching: bot.registry.blocksByName.command_block.id
|
|
31
26
|
})
|
|
32
27
|
bot.setCommandBlock(commandBlock.position, command[1], false)
|
|
33
28
|
break
|
package/examples/digger.js
CHANGED
|
@@ -104,7 +104,6 @@ function build () {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
async function equipDirt () {
|
|
107
|
-
const mcData = require('minecraft-data')(bot.version)
|
|
108
107
|
let itemsByName
|
|
109
108
|
if (bot.supportFeature('itemsAreNotBlocks')) {
|
|
110
109
|
itemsByName = 'itemsByName'
|
|
@@ -112,7 +111,7 @@ async function equipDirt () {
|
|
|
112
111
|
itemsByName = 'blocksByName'
|
|
113
112
|
}
|
|
114
113
|
try {
|
|
115
|
-
await bot.equip(
|
|
114
|
+
await bot.equip(bot.registry[itemsByName].dirt.id, 'hand')
|
|
116
115
|
bot.chat('equipped dirt')
|
|
117
116
|
} catch (err) {
|
|
118
117
|
bot.chat(`unable to equip dirt: ${err.message}`)
|
package/examples/discord.js
CHANGED
package/examples/farmer.js
CHANGED
|
@@ -13,18 +13,13 @@ const bot = mineflayer.createBot({
|
|
|
13
13
|
password: process.argv[5]
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
-
let mcData
|
|
17
|
-
bot.on('inject_allowed', () => {
|
|
18
|
-
mcData = require('minecraft-data')(bot.version)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
16
|
// To fish we have to give bot the seeds
|
|
22
17
|
// /give farmer wheat_seeds 64
|
|
23
18
|
|
|
24
19
|
function blockToSow () {
|
|
25
20
|
return bot.findBlock({
|
|
26
21
|
point: bot.entity.position,
|
|
27
|
-
matching:
|
|
22
|
+
matching: bot.registry.blocksByName.farmland.id,
|
|
28
23
|
maxDistance: 6,
|
|
29
24
|
useExtraInfo: (block) => {
|
|
30
25
|
const blockAbove = bot.blockAt(block.position.offset(0, 1, 0))
|
|
@@ -38,7 +33,7 @@ function blockToHarvest () {
|
|
|
38
33
|
point: bot.entity.position,
|
|
39
34
|
maxDistance: 6,
|
|
40
35
|
matching: (block) => {
|
|
41
|
-
return block && block.type ===
|
|
36
|
+
return block && block.type === bot.registry.blocksByName.wheat.id && block.metadata === 7
|
|
42
37
|
}
|
|
43
38
|
})
|
|
44
39
|
}
|
|
@@ -56,7 +51,7 @@ async function loop () {
|
|
|
56
51
|
while (1) {
|
|
57
52
|
const toSow = blockToSow()
|
|
58
53
|
if (toSow) {
|
|
59
|
-
await bot.equip(
|
|
54
|
+
await bot.equip(bot.registry.itemsByName.wheat_seeds.id, 'hand')
|
|
60
55
|
await bot.placeBlock(toSow, new Vec3(0, 1, 0))
|
|
61
56
|
} else {
|
|
62
57
|
break
|
package/examples/fisherman.js
CHANGED
|
@@ -12,11 +12,6 @@ const bot = mineflayer.createBot({
|
|
|
12
12
|
password: process.argv[5]
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
let mcData
|
|
16
|
-
bot.on('inject_allowed', () => {
|
|
17
|
-
mcData = require('minecraft-data')(bot.version)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
15
|
// To fish we have to give bot the fishing rod and teleport bot to the water
|
|
21
16
|
// /give fisherman fishing_rod 1
|
|
22
17
|
// /teleport fisherman ~ ~ ~
|
|
@@ -50,7 +45,7 @@ function onCollect (player, entity) {
|
|
|
50
45
|
async function startFishing () {
|
|
51
46
|
bot.chat('Fishing')
|
|
52
47
|
try {
|
|
53
|
-
await bot.equip(
|
|
48
|
+
await bot.equip(bot.registry.itemsByName.fishing_rod.id, 'hand')
|
|
54
49
|
} catch (err) {
|
|
55
50
|
return bot.chat(err.message)
|
|
56
51
|
}
|
|
@@ -78,7 +73,7 @@ async function eat () {
|
|
|
78
73
|
stopFishing()
|
|
79
74
|
|
|
80
75
|
try {
|
|
81
|
-
await bot.equip(
|
|
76
|
+
await bot.equip(bot.registry.itemsByName.fish.id, 'hand')
|
|
82
77
|
} catch (err) {
|
|
83
78
|
return bot.chat(err.message)
|
|
84
79
|
}
|