mineflayer 3.17.0 → 4.1.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 -1
- package/README.md +1 -5
- package/docs/README.md +1 -5
- package/docs/api.md +135 -159
- package/docs/es/README_ES.md +6 -6
- package/docs/history.md +14 -0
- package/docs/tutorial.md +27 -78
- package/index.d.ts +39 -58
- package/lib/features.json +28 -28
- package/lib/plugins/anvil.js +4 -4
- package/lib/plugins/bed.js +2 -3
- package/lib/plugins/blocks.js +2 -2
- package/lib/plugins/book.js +4 -5
- package/lib/plugins/chat.js +1 -20
- package/lib/plugins/chest.js +3 -4
- package/lib/plugins/craft.js +1 -2
- package/lib/plugins/creative.js +4 -4
- package/lib/plugins/digging.js +2 -25
- package/lib/plugins/enchantment_table.js +5 -6
- package/lib/plugins/entities.js +3 -2
- package/lib/plugins/fishing.js +2 -2
- package/lib/plugins/furnace.js +6 -7
- package/lib/plugins/inventory.js +17 -15
- package/lib/plugins/physics.js +5 -5
- package/lib/plugins/place_block.js +2 -2
- package/lib/plugins/settings.js +24 -4
- package/lib/plugins/simple_inventory.js +4 -5
- package/lib/plugins/villager.js +2 -3
- package/lib/promise_utils.js +1 -25
- package/lib/version.js +1 -1
- package/package.json +3 -3
package/docs/api.md
CHANGED
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
- [Biome](#biome)
|
|
21
21
|
- [Item](#item)
|
|
22
22
|
- [windows.Window (base class)](#windowswindow-base-class)
|
|
23
|
-
- [window.deposit(itemType, metadata, count,
|
|
24
|
-
- [window.withdraw(itemType, metadata, count,
|
|
23
|
+
- [window.deposit(itemType, metadata, count, nbt)](#windowdeposititemtype-metadata-count-nbt)
|
|
24
|
+
- [window.withdraw(itemType, metadata, count, nbt)](#windowwithdrawitemtype-metadata-count-nbt)
|
|
25
25
|
- [window.close()](#windowclose)
|
|
26
26
|
- [Recipe](#recipe)
|
|
27
27
|
- [mineflayer.Container](#mineflayercontainer)
|
|
28
28
|
- [mineflayer.Furnace](#mineflayerfurnace)
|
|
29
29
|
- [furnace "update"](#furnace-update)
|
|
30
|
-
- [furnace.takeInput(
|
|
31
|
-
- [furnace.takeFuel(
|
|
32
|
-
- [furnace.takeOutput(
|
|
33
|
-
- [furnace.putInput(itemType, metadata, count
|
|
34
|
-
- [furnace.putFuel(itemType, metadata, count
|
|
30
|
+
- [furnace.takeInput()](#furnacetakeinput)
|
|
31
|
+
- [furnace.takeFuel()](#furnacetakefuel)
|
|
32
|
+
- [furnace.takeOutput()](#furnacetakeoutput)
|
|
33
|
+
- [furnace.putInput(itemType, metadata, count)](#furnaceputinputitemtype-metadata-count)
|
|
34
|
+
- [furnace.putFuel(itemType, metadata, count)](#furnaceputfuelitemtype-metadata-count)
|
|
35
35
|
- [furnace.inputItem()](#furnaceinputitem)
|
|
36
36
|
- [furnace.fuelItem()](#furnacefuelitem)
|
|
37
37
|
- [furnace.outputItem()](#furnaceoutputitem)
|
|
@@ -42,16 +42,16 @@
|
|
|
42
42
|
- [enchantmentTable.targetItem()](#enchantmenttabletargetitem)
|
|
43
43
|
- [enchantmentTable.xpseed](#enchantmenttablexpseed)
|
|
44
44
|
- [enchantmentTable.enchantments](#enchantmenttableenchantments)
|
|
45
|
-
- [enchantmentTable.enchant(choice
|
|
46
|
-
- [enchantmentTable.takeTargetItem(
|
|
47
|
-
- [enchantmentTable.putTargetItem(item
|
|
48
|
-
- [enchantmentTable.putLapis(item
|
|
45
|
+
- [enchantmentTable.enchant(choice)](#enchantmenttableenchantchoice)
|
|
46
|
+
- [enchantmentTable.takeTargetItem()](#enchantmenttabletaketargetitem)
|
|
47
|
+
- [enchantmentTable.putTargetItem(item)](#enchantmenttableputtargetitemitem)
|
|
48
|
+
- [enchantmentTable.putLapis(item)](#enchantmenttableputlapisitem)
|
|
49
49
|
- [mineflayer.anvil](#mineflayeranvil)
|
|
50
|
-
- [anvil.combine(itemOne, itemTwo[, name
|
|
51
|
-
- [anvil.combine(item[, name
|
|
50
|
+
- [anvil.combine(itemOne, itemTwo[, name])](#anvilcombineitemone-itemtwo-name)
|
|
51
|
+
- [anvil.combine(item[, name])](#anvilcombineitem-name)
|
|
52
52
|
- [villager "ready"](#villager-ready)
|
|
53
53
|
- [villager.trades](#villagertrades)
|
|
54
|
-
- [villager.trade(tradeIndex, [times]
|
|
54
|
+
- [villager.trade(tradeIndex, [times])](#villagertradetradeindex-times)
|
|
55
55
|
- [mineflayer.ScoreBoard](#mineflayerscoreboard)
|
|
56
56
|
- [ScoreBoard.name](#scoreboardname)
|
|
57
57
|
- [ScoreBoard.title](#scoreboardtitle)
|
|
@@ -94,6 +94,8 @@
|
|
|
94
94
|
- [bot.game.hardcore](#botgamehardcore)
|
|
95
95
|
- [bot.game.maxPlayers](#botgamemaxplayers)
|
|
96
96
|
- [bot.game.serverBrand](#botgameserverbrand)
|
|
97
|
+
- [bot.game.minY](#botgameminy)
|
|
98
|
+
- [bot.game.height](#botgameheight)
|
|
97
99
|
- [bot.physicsEnabled](#botphysicsenabled)
|
|
98
100
|
- [bot.player](#botplayer)
|
|
99
101
|
- [bot.players](#botplayers)
|
|
@@ -113,6 +115,8 @@
|
|
|
113
115
|
- [bot.settings.skinParts.showLeftPants - boolean](#botsettingsskinpartsshowleftpants---boolean)
|
|
114
116
|
- [bot.settings.skinParts.showRightPants - boolean](#botsettingsskinpartsshowrightpants---boolean)
|
|
115
117
|
- [bot.settings.skinParts.showHat - boolean](#botsettingsskinpartsshowhat---boolean)
|
|
118
|
+
- [bot.settings.enableTextFiltering - boolean](#botsettingsenabletextfiltering---boolean)
|
|
119
|
+
- [bot.settings.enableServerListing - boolean](#botsettingsenableserverlisting---boolean)
|
|
116
120
|
- [bot.experience.level](#botexperiencelevel)
|
|
117
121
|
- [bot.experience.points](#botexperiencepoints)
|
|
118
122
|
- [bot.experience.progress](#botexperienceprogress)
|
|
@@ -235,7 +239,7 @@
|
|
|
235
239
|
- ["chat:name" (matches)](#chatname-matches)
|
|
236
240
|
- [Functions](#functions)
|
|
237
241
|
- [bot.blockAt(point, extraInfos=true)](#botblockatpoint-extrainfostrue)
|
|
238
|
-
- [bot.waitForChunksToLoad(
|
|
242
|
+
- [bot.waitForChunksToLoad()](#botwaitforchunkstoload)
|
|
239
243
|
- [bot.blockInSight(maxSteps, vectorLength)](#botblockinsightmaxsteps-vectorlength)
|
|
240
244
|
- [bot.blockAtCursor(maxDistance=256)](#botblockatcursormaxdistance256)
|
|
241
245
|
- [bot.blockAtEntityCursor(entity=bot.entity, maxDistance=256)](#botblockatentitycursorentitybotentity-maxdistance256)
|
|
@@ -249,7 +253,7 @@
|
|
|
249
253
|
- [Methods](#methods)
|
|
250
254
|
- [bot.end(reason)](#botendreason)
|
|
251
255
|
- [bot.quit(reason)](#botquitreason)
|
|
252
|
-
- [bot.tabComplete(str,
|
|
256
|
+
- [bot.tabComplete(str, [assumeCommand], [sendBlockInSight])](#bottabcompletestr-assumecommand-sendblockinsight)
|
|
253
257
|
- [bot.chat(message)](#botchatmessage)
|
|
254
258
|
- [bot.whisper(username, message)](#botwhisperusername-message)
|
|
255
259
|
- [bot.chatAddPattern(pattern, chatType, description)](#botchataddpatternpattern-chattype-description)
|
|
@@ -261,32 +265,32 @@
|
|
|
261
265
|
- [bot.loadPlugin(plugin)](#botloadpluginplugin)
|
|
262
266
|
- [bot.loadPlugins(plugins)](#botloadpluginsplugins)
|
|
263
267
|
- [bot.hasPlugin(plugin)](#bothaspluginplugin)
|
|
264
|
-
- [bot.sleep(bedBlock
|
|
268
|
+
- [bot.sleep(bedBlock)](#botsleepbedblock)
|
|
265
269
|
- [bot.isABed(bedBlock)](#botisabedbedblock)
|
|
266
|
-
- [bot.wake(
|
|
270
|
+
- [bot.wake()](#botwake)
|
|
267
271
|
- [bot.setControlState(control, state)](#botsetcontrolstatecontrol-state)
|
|
268
272
|
- [bot.getControlState(control)](#botgetcontrolstatecontrol)
|
|
269
273
|
- [bot.clearControlStates()](#botclearcontrolstates)
|
|
270
274
|
- [bot.getExplosionDamages(entity, position, radius, [rawDamages])](#botgetexplosiondamagesentity-position-radius-rawdamages)
|
|
271
|
-
- [bot.lookAt(point, [force]
|
|
272
|
-
- [bot.look(yaw, pitch, [force]
|
|
275
|
+
- [bot.lookAt(point, [force])](#botlookatpoint-force)
|
|
276
|
+
- [bot.look(yaw, pitch, [force])](#botlookyaw-pitch-force)
|
|
273
277
|
- [bot.updateSign(block, text)](#botupdatesignblock-text)
|
|
274
|
-
- [bot.equip(item, destination
|
|
275
|
-
- [bot.unequip(destination
|
|
276
|
-
- [bot.tossStack(item
|
|
277
|
-
- [bot.toss(itemType, metadata, count
|
|
278
|
-
- [bot.dig(block, [forceLook = true], [digFace]
|
|
278
|
+
- [bot.equip(item, destination)](#botequipitem-destination)
|
|
279
|
+
- [bot.unequip(destination)](#botunequipdestination)
|
|
280
|
+
- [bot.tossStack(item)](#bottossstackitem)
|
|
281
|
+
- [bot.toss(itemType, metadata, count)](#bottossitemtype-metadata-count)
|
|
282
|
+
- [bot.dig(block, [forceLook = true], [digFace])](#botdigblock-forcelook--true-digface)
|
|
279
283
|
- [bot.stopDigging()](#botstopdigging)
|
|
280
284
|
- [bot.digTime(block)](#botdigtimeblock)
|
|
281
285
|
- [bot.acceptResourcePack()](#botacceptresourcepack)
|
|
282
286
|
- [bot.denyResourcePack()](#botdenyresourcepack)
|
|
283
|
-
- [bot.placeBlock(referenceBlock, faceVector
|
|
287
|
+
- [bot.placeBlock(referenceBlock, faceVector)](#botplaceblockreferenceblock-facevector)
|
|
284
288
|
- [bot.placeEntity(referenceBlock, faceVector)](#botplaceentityreferenceblock-facevector)
|
|
285
|
-
- [bot.activateBlock(block
|
|
286
|
-
- [bot.activateEntity(entity
|
|
287
|
-
- [bot.activateEntityAt(entity, position
|
|
288
|
-
- [bot.consume(
|
|
289
|
-
- [bot.fish(
|
|
289
|
+
- [bot.activateBlock(block)](#botactivateblockblock)
|
|
290
|
+
- [bot.activateEntity(entity)](#botactivateentityentity)
|
|
291
|
+
- [bot.activateEntityAt(entity, position)](#botactivateentityatentity-position)
|
|
292
|
+
- [bot.consume()](#botconsume)
|
|
293
|
+
- [bot.fish()](#botfish)
|
|
290
294
|
- [bot.activateItem(offHand=false)](#botactivateitemoffhandfalse)
|
|
291
295
|
- [bot.deactivateItem()](#botdeactivateitem)
|
|
292
296
|
- [bot.useOn(targetEntity)](#botuseontargetentity)
|
|
@@ -296,8 +300,8 @@
|
|
|
296
300
|
- [bot.dismount()](#botdismount)
|
|
297
301
|
- [bot.moveVehicle(left,forward)](#botmovevehicleleftforward)
|
|
298
302
|
- [bot.setQuickBarSlot(slot)](#botsetquickbarslotslot)
|
|
299
|
-
- [bot.craft(recipe, count, craftingTable
|
|
300
|
-
- [bot.writeBook(slot, pages
|
|
303
|
+
- [bot.craft(recipe, count, craftingTable)](#botcraftrecipe-count-craftingtable)
|
|
304
|
+
- [bot.writeBook(slot, pages)](#botwritebookslot-pages)
|
|
301
305
|
- [bot.openContainer(containerBlock or containerEntity)](#botopencontainercontainerblock-or-containerentity)
|
|
302
306
|
- [bot.openChest(chestBlock or minecartchestEntity)](#botopenchestchestblock-or-minecartchestentity)
|
|
303
307
|
- [bot.openFurnace(furnaceBlock)](#botopenfurnacefurnaceblock)
|
|
@@ -305,24 +309,24 @@
|
|
|
305
309
|
- [bot.openEnchantmentTable(enchantmentTableBlock)](#botopenenchantmenttableenchantmenttableblock)
|
|
306
310
|
- [bot.openAnvil(anvilBlock)](#botopenanvilanvilblock)
|
|
307
311
|
- [bot.openVillager(villagerEntity)](#botopenvillagervillagerentity)
|
|
308
|
-
- [bot.trade(villagerInstance, tradeIndex, [times]
|
|
312
|
+
- [bot.trade(villagerInstance, tradeIndex, [times])](#bottradevillagerinstance-tradeindex-times)
|
|
309
313
|
- [bot.setCommandBlock(pos, command, [options])](#botsetcommandblockpos-command-options)
|
|
310
314
|
- [bot.supportFeature(name)](#botsupportfeaturename)
|
|
311
315
|
- [bot.waitForTicks(ticks)](#botwaitforticksticks)
|
|
312
316
|
- [Lower level inventory methods](#lower-level-inventory-methods)
|
|
313
|
-
- [bot.clickWindow(slot, mouseButton, mode
|
|
317
|
+
- [bot.clickWindow(slot, mouseButton, mode)](#botclickwindowslot-mousebutton-mode)
|
|
314
318
|
- [bot.putSelectedItemRange(start, end, window, slot)](#botputselecteditemrangestart-end-window-slot)
|
|
315
319
|
- [bot.putAway(slot)](#botputawayslot)
|
|
316
320
|
- [bot.closeWindow(window)](#botclosewindowwindow)
|
|
317
|
-
- [bot.transfer(options
|
|
321
|
+
- [bot.transfer(options)](#bottransferoptions)
|
|
318
322
|
- [bot.openBlock(block)](#botopenblockblock)
|
|
319
323
|
- [bot.openEntity(entity)](#botopenentityentity)
|
|
320
|
-
- [bot.moveSlotItem(sourceSlot, destSlot
|
|
324
|
+
- [bot.moveSlotItem(sourceSlot, destSlot)](#botmoveslotitemsourceslot-destslot)
|
|
321
325
|
- [bot.updateHeldItem()](#botupdatehelditem)
|
|
322
326
|
- [bot.getEquipmentDestSlot(destination)](#botgetequipmentdestslotdestination)
|
|
323
327
|
- [bot.creative](#botcreative)
|
|
324
|
-
- [bot.creative.setInventorySlot(slot, item
|
|
325
|
-
- [bot.creative.flyTo(destination
|
|
328
|
+
- [bot.creative.setInventorySlot(slot, item)](#botcreativesetinventoryslotslot-item)
|
|
329
|
+
- [bot.creative.flyTo(destination)](#botcreativeflytodestination)
|
|
326
330
|
- [bot.creative.startFlying()](#botcreativestartflying)
|
|
327
331
|
- [bot.creative.stopFlying()](#botcreativestopflying)
|
|
328
332
|
|
|
@@ -418,23 +422,23 @@ See [prismarine-item](https://github.com/PrismarineJS/prismarine-item)
|
|
|
418
422
|
|
|
419
423
|
See [prismarine-windows](https://github.com/PrismarineJS/prismarine-windows)
|
|
420
424
|
|
|
421
|
-
#### window.deposit(itemType, metadata, count,
|
|
425
|
+
#### window.deposit(itemType, metadata, count, nbt)
|
|
422
426
|
|
|
423
|
-
This function
|
|
427
|
+
This function returns a `Promise`, with `void` as its argument when done depositing.
|
|
424
428
|
|
|
425
429
|
* `itemType` - numerical item id
|
|
426
430
|
* `metadata` - numerical value. `null` means match anything.
|
|
427
431
|
* `count` - how many to deposit. `null` is an alias to 1.
|
|
428
|
-
* `
|
|
432
|
+
* `nbt` - match nbt data. `null` is do not match nbt.
|
|
429
433
|
|
|
430
|
-
#### window.withdraw(itemType, metadata, count,
|
|
434
|
+
#### window.withdraw(itemType, metadata, count, nbt)
|
|
431
435
|
|
|
432
|
-
This function
|
|
436
|
+
This function returns a `Promise`, with `void` as its argument when done withdrawing. Throws and error if the bot has no free room in its inventory.
|
|
433
437
|
|
|
434
438
|
* `itemType` - numerical item id
|
|
435
439
|
* `metadata` - numerical value. `null` means match anything.
|
|
436
440
|
* `count` - how many to withdraw. `null` is an alias to 1.
|
|
437
|
-
* `
|
|
441
|
+
* `nbt` - match nbt data. `null` is do not match nbt.
|
|
438
442
|
|
|
439
443
|
#### window.close()
|
|
440
444
|
|
|
@@ -456,31 +460,28 @@ See `bot.openFurnace(furnaceBlock)`.
|
|
|
456
460
|
|
|
457
461
|
Fires when `furnace.fuel` and/or `furnace.progress` update.
|
|
458
462
|
|
|
459
|
-
#### furnace.takeInput(
|
|
463
|
+
#### furnace.takeInput()
|
|
460
464
|
|
|
461
|
-
This function
|
|
465
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
462
466
|
|
|
463
|
-
* `callback(err, item)`
|
|
464
467
|
|
|
465
|
-
#### furnace.takeFuel(
|
|
468
|
+
#### furnace.takeFuel()
|
|
466
469
|
|
|
467
|
-
This function
|
|
470
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
468
471
|
|
|
469
|
-
* `callback(err, item)`
|
|
470
472
|
|
|
471
|
-
#### furnace.takeOutput(
|
|
473
|
+
#### furnace.takeOutput()
|
|
472
474
|
|
|
473
|
-
This function
|
|
475
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
474
476
|
|
|
475
|
-
* `callback(err, item)`
|
|
476
477
|
|
|
477
|
-
#### furnace.putInput(itemType, metadata, count
|
|
478
|
+
#### furnace.putInput(itemType, metadata, count)
|
|
478
479
|
|
|
479
|
-
This function
|
|
480
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
480
481
|
|
|
481
|
-
#### furnace.putFuel(itemType, metadata, count
|
|
482
|
+
#### furnace.putFuel(itemType, metadata, count)
|
|
482
483
|
|
|
483
|
-
This function
|
|
484
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
484
485
|
|
|
485
486
|
#### furnace.inputItem()
|
|
486
487
|
|
|
@@ -542,47 +543,41 @@ Looks like:
|
|
|
542
543
|
]
|
|
543
544
|
```
|
|
544
545
|
|
|
545
|
-
#### enchantmentTable.enchant(choice
|
|
546
|
+
#### enchantmentTable.enchant(choice)
|
|
546
547
|
|
|
547
|
-
This function
|
|
548
|
+
This function returns a `Promise`, with `item` as its argument when the item has been enchanted.
|
|
548
549
|
|
|
549
550
|
* `choice` - [0-2], the index of the enchantment you want to pick.
|
|
550
|
-
* `callback(err, item)` - (optional) called when the item has been enchanted
|
|
551
551
|
|
|
552
|
-
#### enchantmentTable.takeTargetItem(
|
|
552
|
+
#### enchantmentTable.takeTargetItem()
|
|
553
553
|
|
|
554
|
-
This function
|
|
554
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
555
555
|
|
|
556
|
-
* `callback(err, item)`
|
|
557
556
|
|
|
558
|
-
#### enchantmentTable.putTargetItem(item
|
|
557
|
+
#### enchantmentTable.putTargetItem(item)
|
|
559
558
|
|
|
560
|
-
This function
|
|
559
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
561
560
|
|
|
562
|
-
* `callback(err)`
|
|
563
561
|
|
|
564
|
-
#### enchantmentTable.putLapis(item
|
|
562
|
+
#### enchantmentTable.putLapis(item)
|
|
565
563
|
|
|
566
|
-
This function
|
|
564
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
567
565
|
|
|
568
|
-
* `callback(err)`
|
|
569
566
|
|
|
570
567
|
### mineflayer.anvil
|
|
571
568
|
|
|
572
569
|
Extends windows.Window for anvils
|
|
573
570
|
See `bot.openAnvil(anvilBlock)`.
|
|
574
571
|
|
|
575
|
-
#### anvil.combine(itemOne, itemTwo[, name
|
|
572
|
+
#### anvil.combine(itemOne, itemTwo[, name])
|
|
576
573
|
|
|
577
|
-
This function
|
|
574
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
578
575
|
|
|
579
|
-
* `callback(err)` - in order to use callback, pass an empty string ('') for name
|
|
580
576
|
|
|
581
|
-
#### anvil.combine(item[, name
|
|
577
|
+
#### anvil.combine(item[, name])
|
|
582
578
|
|
|
583
|
-
This function
|
|
579
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
584
580
|
|
|
585
|
-
* `callback(err)`
|
|
586
581
|
|
|
587
582
|
#### villager "ready"
|
|
588
583
|
|
|
@@ -626,8 +621,8 @@ Looks like:
|
|
|
626
621
|
]
|
|
627
622
|
```
|
|
628
623
|
|
|
629
|
-
#### villager.trade(tradeIndex, [times]
|
|
630
|
-
Is the same as [bot.trade(villagerInstance, tradeIndex, [times]
|
|
624
|
+
#### villager.trade(tradeIndex, [times])
|
|
625
|
+
Is the same as [bot.trade(villagerInstance, tradeIndex, [times])](#bottradevillagerinstance-tradeindex-times)
|
|
631
626
|
|
|
632
627
|
### mineflayer.ScoreBoard
|
|
633
628
|
|
|
@@ -756,6 +751,8 @@ Create and return an instance of the class bot.
|
|
|
756
751
|
* [viewDistance](#bot.settings.viewDistance)
|
|
757
752
|
* [difficulty](#bot.settings.difficulty)
|
|
758
753
|
* [skinParts](#bot.settings.skinParts)
|
|
754
|
+
* [enableTextFiltering](#bot.settings.enableTextFiltering)
|
|
755
|
+
* [enableServerListing](#bot.settings.enableServerListing)
|
|
759
756
|
* chatLengthLimit : the maximum amount of characters that can be sent in a single message. If this is not set, it will be 100 in < 1.11 and 256 in >= 1.11.
|
|
760
757
|
* defaultChatPatterns: defaults to true, set to false to not add the patterns such as chat and whisper
|
|
761
758
|
|
|
@@ -892,6 +889,7 @@ Default true, whether or not you receive color codes in chats from the server.
|
|
|
892
889
|
|
|
893
890
|
#### bot.settings.viewDistance
|
|
894
891
|
|
|
892
|
+
Can be a string listed below or a postive number.
|
|
895
893
|
Choices:
|
|
896
894
|
* `far` (default)
|
|
897
895
|
* `normal`
|
|
@@ -922,7 +920,10 @@ If you have a cape you can turn it off by setting this to false.
|
|
|
922
920
|
|
|
923
921
|
##### bot.settings.skinParts.showHat - boolean
|
|
924
922
|
|
|
925
|
-
|
|
923
|
+
#### bot.settings.enableTextFiltering - boolean
|
|
924
|
+
Unused, defaults to false in Notchian (Vanilla) client.
|
|
925
|
+
#### bot.settings.enableServerListing - boolean
|
|
926
|
+
This setting is sent to the server to determine whether the player should show up in server listings
|
|
926
927
|
#### bot.experience.level
|
|
927
928
|
|
|
928
929
|
#### bot.experience.points
|
|
@@ -1440,11 +1441,9 @@ Fires when the all of a chat pattern's regexs have matches
|
|
|
1440
1441
|
Returns the block at `point` or `null` if that point is not loaded. If `extraInfos` set to true, also returns informations about signs, paintings and block entities (slower).
|
|
1441
1442
|
See `Block`.
|
|
1442
1443
|
|
|
1443
|
-
#### bot.waitForChunksToLoad(
|
|
1444
|
-
|
|
1445
|
-
This function also returns a `Promise`, with `void` as its argument upon completion.
|
|
1444
|
+
#### bot.waitForChunksToLoad()
|
|
1446
1445
|
|
|
1447
|
-
|
|
1446
|
+
This function returns a `Promise`, with `void` as its argument when many chunks have loaded.
|
|
1448
1447
|
|
|
1449
1448
|
#### bot.blockInSight(maxSteps, vectorLength)
|
|
1450
1449
|
|
|
@@ -1529,14 +1528,12 @@ End the connection with the server.
|
|
|
1529
1528
|
|
|
1530
1529
|
Gracefully disconnect from the server with the given reason (defaults to 'disconnect.quitting').
|
|
1531
1530
|
|
|
1532
|
-
#### bot.tabComplete(str,
|
|
1531
|
+
#### bot.tabComplete(str, [assumeCommand], [sendBlockInSight])
|
|
1533
1532
|
|
|
1534
|
-
This function
|
|
1533
|
+
This function returns a `Promise`, with `matches` as its argument upon completion.
|
|
1535
1534
|
|
|
1536
1535
|
Requests chat completion from the server.
|
|
1537
1536
|
* `str` - String to complete.
|
|
1538
|
-
* `callback(matches)`
|
|
1539
|
-
- `matches` - Array of matching strings.
|
|
1540
1537
|
* `assumeCommand` - Field sent to server, defaults to false.
|
|
1541
1538
|
* `sendBlockInSight` - Field sent to server, defaults to true. Set this option to false if you want more performance.
|
|
1542
1539
|
|
|
@@ -1644,21 +1641,21 @@ Injects plugins see `bot.loadPlugin`.
|
|
|
1644
1641
|
|
|
1645
1642
|
Checks if the given plugin is loaded (or scheduled to be loaded) on this bot.
|
|
1646
1643
|
|
|
1647
|
-
#### bot.sleep(bedBlock
|
|
1644
|
+
#### bot.sleep(bedBlock)
|
|
1648
1645
|
|
|
1649
|
-
This function
|
|
1646
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1650
1647
|
|
|
1651
|
-
Sleep in a bed. `bedBlock` should be a `Block` instance which is a bed.
|
|
1648
|
+
Sleep in a bed. `bedBlock` should be a `Block` instance which is a bed.
|
|
1652
1649
|
|
|
1653
1650
|
#### bot.isABed(bedBlock)
|
|
1654
1651
|
|
|
1655
1652
|
Return true if `bedBlock` is a bed
|
|
1656
1653
|
|
|
1657
|
-
#### bot.wake(
|
|
1654
|
+
#### bot.wake()
|
|
1658
1655
|
|
|
1659
|
-
This function
|
|
1656
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1660
1657
|
|
|
1661
|
-
Get out of bed.
|
|
1658
|
+
Get out of bed.
|
|
1662
1659
|
|
|
1663
1660
|
#### bot.setControlState(control, state)
|
|
1664
1661
|
|
|
@@ -1689,17 +1686,16 @@ It will return `null` if the entity has no armor and rawDamages is not set to tr
|
|
|
1689
1686
|
* `radius` - the explosion radius as a number
|
|
1690
1687
|
* `rawDamages` - optional, if true it ignores armor in the calculation
|
|
1691
1688
|
|
|
1692
|
-
#### bot.lookAt(point, [force]
|
|
1689
|
+
#### bot.lookAt(point, [force])
|
|
1693
1690
|
|
|
1694
|
-
This function
|
|
1691
|
+
This function returns a `Promise`, with `void` as its argument when you are looking at `point`.
|
|
1695
1692
|
|
|
1696
1693
|
* `point` [Vec3](https://github.com/andrewrk/node-vec3) instance - tilts your head so that it is directly facing this point.
|
|
1697
1694
|
* `force` - See `force` in `bot.look`
|
|
1698
|
-
* `callback()` optional, called when you are looking at `point`
|
|
1699
1695
|
|
|
1700
|
-
#### bot.look(yaw, pitch, [force]
|
|
1696
|
+
#### bot.look(yaw, pitch, [force])
|
|
1701
1697
|
|
|
1702
|
-
This function
|
|
1698
|
+
This function returns a `Promise`, with `void` as its argument called when you are looking at `yaw` and `pitch`.
|
|
1703
1699
|
|
|
1704
1700
|
Set the direction your head is facing.
|
|
1705
1701
|
|
|
@@ -1711,15 +1707,14 @@ Set the direction your head is facing.
|
|
|
1711
1707
|
Specify this to true if you need the server to know exactly where you
|
|
1712
1708
|
are looking, such as for dropping items or shooting arrows. This is not
|
|
1713
1709
|
needed for client-side calculation such as walking direction.
|
|
1714
|
-
* `callback()` optional, called when you are looking at `yaw` and `pitch`
|
|
1715
1710
|
|
|
1716
1711
|
#### bot.updateSign(block, text)
|
|
1717
1712
|
|
|
1718
1713
|
Changes the text on the sign.
|
|
1719
1714
|
|
|
1720
|
-
#### bot.equip(item, destination
|
|
1715
|
+
#### bot.equip(item, destination)
|
|
1721
1716
|
|
|
1722
|
-
This function
|
|
1717
|
+
This function returns a `Promise`, with `void` as its argument when you have successfully equipped the item or when you learn that you have failed to equip the item.
|
|
1723
1718
|
|
|
1724
1719
|
Equips an item from your inventory. If the argument `item` is of Instance `Item` equip will equip this specific item from its window slot. If the argument `item` is of type `number` equip will equip the first item found with that id searched by rising slot id (Hotbar is searched last. Armor, crafting, crafting result and off-hand slots are excluded).
|
|
1725
1720
|
|
|
@@ -1731,36 +1726,32 @@ Equips an item from your inventory. If the argument `item` is of Instance `Item`
|
|
|
1731
1726
|
- `"legs"`
|
|
1732
1727
|
- `"feet"`
|
|
1733
1728
|
- `"off-hand"` - when available
|
|
1734
|
-
* `callback(error)` - optional. called when you have successfully equipped
|
|
1735
|
-
the item or when you learn that you have failed to equip the item.
|
|
1736
1729
|
|
|
1737
|
-
#### bot.unequip(destination
|
|
1730
|
+
#### bot.unequip(destination)
|
|
1738
1731
|
|
|
1739
|
-
This function
|
|
1732
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1740
1733
|
|
|
1741
1734
|
Remove an article of equipment.
|
|
1742
1735
|
|
|
1743
|
-
#### bot.tossStack(item
|
|
1736
|
+
#### bot.tossStack(item)
|
|
1744
1737
|
|
|
1745
|
-
This function
|
|
1738
|
+
This function returns a `Promise`, with `void` as its argument when tossing is done.
|
|
1746
1739
|
|
|
1747
1740
|
* `item` - the stack of items you wish to toss
|
|
1748
|
-
* `callback(error)` - optional, called when tossing is done. if error is
|
|
1749
1741
|
truthy, you were not able to complete the toss.
|
|
1750
1742
|
|
|
1751
|
-
#### bot.toss(itemType, metadata, count
|
|
1743
|
+
#### bot.toss(itemType, metadata, count)
|
|
1752
1744
|
|
|
1753
|
-
This function
|
|
1745
|
+
This function returns a `Promise`, with `void` as its argument once tossing is complete.
|
|
1754
1746
|
|
|
1755
1747
|
* `itemType` - numerical id of the item you wish to toss
|
|
1756
1748
|
* `metadata` - metadata of the item you wish to toss. Use `null`
|
|
1757
1749
|
to match any metadata
|
|
1758
1750
|
* `count` - how many you want to toss. `null` is an alias for `1`.
|
|
1759
|
-
* `callback(err)` - (optional) called once tossing is complete
|
|
1760
1751
|
|
|
1761
|
-
#### bot.dig(block, [forceLook = true], [digFace]
|
|
1752
|
+
#### bot.dig(block, [forceLook = true], [digFace])
|
|
1762
1753
|
|
|
1763
|
-
This function
|
|
1754
|
+
This function returns a `Promise`, with `void` as its argument when the block is broken or you are interrupted.
|
|
1764
1755
|
|
|
1765
1756
|
Begin digging into `block` with the currently equipped item.
|
|
1766
1757
|
See also "diggingCompleted" and "diggingAborted" events.
|
|
@@ -1773,8 +1764,6 @@ dig any other blocks until the block has been broken, or you call
|
|
|
1773
1764
|
* `forceLook` - (optional) if true, look at the block and start mining instantly. If false, the bot will slowly turn to the block to mine. Additionally, this can be assigned to 'ignore' to prevent the bot from moving it's head at all. Also, this can be assigned to 'raycast' to raycast from the bots head to place where the bot is looking.
|
|
1774
1765
|
* `digFace` - (optional) Default is 'auto' looks at the center of the block and mines the top face. Can also be a vec3 vector
|
|
1775
1766
|
of the face the bot should be looking at when digging the block. For example: ```vec3(0, 1, 0)``` when mining the top. Can also be 'raycast' raycast checks if there is a face visible by the bot and mines that face. Useful for servers with anti cheat.
|
|
1776
|
-
* `callback(err)` - (optional) called when the block is broken or you
|
|
1777
|
-
are interrupted.
|
|
1778
1767
|
|
|
1779
1768
|
If you call bot.dig twice before the first dig is finished, you will get a fatal 'diggingAborted' error.
|
|
1780
1769
|
|
|
@@ -1792,20 +1781,19 @@ Accepts resource pack.
|
|
|
1792
1781
|
|
|
1793
1782
|
Denies resource pack.
|
|
1794
1783
|
|
|
1795
|
-
#### bot.placeBlock(referenceBlock, faceVector
|
|
1784
|
+
#### bot.placeBlock(referenceBlock, faceVector)
|
|
1796
1785
|
|
|
1797
|
-
This function
|
|
1786
|
+
This function returns a `Promise`, with `void` as its argument when the server confirms that the block has indeed been placed.
|
|
1798
1787
|
|
|
1799
1788
|
* `referenceBlock` - the block you want to place a new block next to
|
|
1800
1789
|
* `faceVector` - one of the six cardinal directions, such as `new Vec3(0, 1, 0)` for the top face,
|
|
1801
1790
|
indicating which face of the `referenceBlock` to place the block against.
|
|
1802
|
-
* `cb` will be called when the server confirms that the block has indeed been placed
|
|
1803
1791
|
|
|
1804
1792
|
The new block will be placed at `referenceBlock.position.plus(faceVector)`.
|
|
1805
1793
|
|
|
1806
1794
|
#### bot.placeEntity(referenceBlock, faceVector)
|
|
1807
1795
|
|
|
1808
|
-
This function
|
|
1796
|
+
This function returns a `Promise`, with `Entity` as its argument upon completion.
|
|
1809
1797
|
|
|
1810
1798
|
* `referenceBlock` - the block you want to place the entity next to
|
|
1811
1799
|
* `faceVector` - one of the six cardinal directions, such as `new Vec3(0, 1, 0)` for the top face,
|
|
@@ -1813,49 +1801,44 @@ This function also returns a `Promise`, with `Entity` as its argument upon compl
|
|
|
1813
1801
|
|
|
1814
1802
|
The new block will be placed at `referenceBlock.position.plus(faceVector)`.
|
|
1815
1803
|
|
|
1816
|
-
#### bot.activateBlock(block
|
|
1804
|
+
#### bot.activateBlock(block)
|
|
1817
1805
|
|
|
1818
|
-
This function
|
|
1806
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1819
1807
|
|
|
1820
1808
|
Punch a note block, open a door, etc.
|
|
1821
1809
|
|
|
1822
1810
|
* `block` - the block to activate
|
|
1823
|
-
* `callback(err)` - (optional) called when the block has been activated
|
|
1824
1811
|
|
|
1825
|
-
#### bot.activateEntity(entity
|
|
1812
|
+
#### bot.activateEntity(entity)
|
|
1826
1813
|
|
|
1827
|
-
This function
|
|
1814
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1828
1815
|
|
|
1829
1816
|
Activate an entity, useful for villager for example.
|
|
1830
1817
|
|
|
1831
1818
|
* `entity` - the entity to activate
|
|
1832
|
-
* `callback(err)` - (optional) called when the entity has been activated
|
|
1833
1819
|
|
|
1834
|
-
#### bot.activateEntityAt(entity, position
|
|
1820
|
+
#### bot.activateEntityAt(entity, position)
|
|
1835
1821
|
|
|
1836
|
-
This function
|
|
1822
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1837
1823
|
|
|
1838
1824
|
Activate an entity at the given position, useful for armor stands.
|
|
1839
1825
|
|
|
1840
1826
|
* `entity` - the entity to activate
|
|
1841
1827
|
* `position` - the world position to click at
|
|
1842
|
-
* `callback(err)` - (optional) called when the entity has been activated
|
|
1843
1828
|
|
|
1844
|
-
#### bot.consume(
|
|
1829
|
+
#### bot.consume()
|
|
1845
1830
|
|
|
1846
|
-
This function
|
|
1831
|
+
This function returns a `Promise`, with `void` as its argument when consume ends.
|
|
1847
1832
|
|
|
1848
1833
|
Eat / drink currently held item
|
|
1849
1834
|
|
|
1850
|
-
* `callback(error)` - called when consume ends
|
|
1851
1835
|
|
|
1852
|
-
#### bot.fish(
|
|
1836
|
+
#### bot.fish()
|
|
1853
1837
|
|
|
1854
|
-
This function
|
|
1838
|
+
This function returns a `Promise`, with `void` as its argument when fishing ends.
|
|
1855
1839
|
|
|
1856
1840
|
Use fishing rod
|
|
1857
1841
|
|
|
1858
|
-
* `callback(error)` - called when fishing ends
|
|
1859
1842
|
|
|
1860
1843
|
#### bot.activateItem(offHand=false)
|
|
1861
1844
|
|
|
@@ -1906,9 +1889,9 @@ All the direction are relative to where the bot is looking at
|
|
|
1906
1889
|
|
|
1907
1890
|
* `slot` - 0-8 the quick bar slot to select.
|
|
1908
1891
|
|
|
1909
|
-
#### bot.craft(recipe, count, craftingTable
|
|
1892
|
+
#### bot.craft(recipe, count, craftingTable)
|
|
1910
1893
|
|
|
1911
|
-
This function
|
|
1894
|
+
This function returns a `Promise`, with `void` as its argument when the crafting is complete and your inventory is updated.
|
|
1912
1895
|
|
|
1913
1896
|
* `recipe` - A `Recipe` instance. See `bot.recipesFor`.
|
|
1914
1897
|
* `count` - How many times you wish to perform the operation.
|
|
@@ -1917,16 +1900,13 @@ This function also returns a `Promise`, with `void` as its argument upon complet
|
|
|
1917
1900
|
* `craftingTable` - A `Block` instance, the crafting table you wish to
|
|
1918
1901
|
use. If the recipe does not require a crafting table, you may use
|
|
1919
1902
|
`null` for this argument.
|
|
1920
|
-
* `callback` - (optional) Called when the crafting is complete and your
|
|
1921
|
-
inventory is updated.
|
|
1922
1903
|
|
|
1923
|
-
#### bot.writeBook(slot, pages
|
|
1904
|
+
#### bot.writeBook(slot, pages)
|
|
1924
1905
|
|
|
1925
|
-
This function
|
|
1906
|
+
This function returns a `Promise`, with `void` as its argument when the writing was successfully or an error occurred.
|
|
1926
1907
|
|
|
1927
1908
|
* `slot` is in inventory window coordinates (where 36 is the first quickbar slot, etc.).
|
|
1928
1909
|
* `pages` is an array of strings represents the pages.
|
|
1929
|
-
* `callback(error)` - optional. called when the writing was successfully or an error occurred.
|
|
1930
1910
|
|
|
1931
1911
|
#### bot.openContainer(containerBlock or containerEntity)
|
|
1932
1912
|
|
|
@@ -1958,9 +1938,9 @@ Returns a promise on an `anvil` instance which represents the anvil you are open
|
|
|
1958
1938
|
Returns a promise on a `Villager` instance which represents the trading window you are opening.
|
|
1959
1939
|
You can listen to the `ready` event on this `Villager` to know when it's ready
|
|
1960
1940
|
|
|
1961
|
-
#### bot.trade(villagerInstance, tradeIndex, [times]
|
|
1941
|
+
#### bot.trade(villagerInstance, tradeIndex, [times])
|
|
1962
1942
|
|
|
1963
|
-
This function
|
|
1943
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1964
1944
|
|
|
1965
1945
|
Uses the open `villagerInstance` to trade.
|
|
1966
1946
|
|
|
@@ -1993,21 +1973,21 @@ This is a promise-based function that waits for a given number of in-game ticks
|
|
|
1993
1973
|
|
|
1994
1974
|
These are lower level methods for the inventory, they can be useful sometimes but prefer the inventory methods presented above if you can.
|
|
1995
1975
|
|
|
1996
|
-
#### bot.clickWindow(slot, mouseButton, mode
|
|
1976
|
+
#### bot.clickWindow(slot, mouseButton, mode)
|
|
1997
1977
|
|
|
1998
|
-
This function
|
|
1978
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1999
1979
|
|
|
2000
1980
|
Click on the current window. See details at https://wiki.vg/Protocol#Click_Window
|
|
2001
1981
|
|
|
2002
1982
|
#### bot.putSelectedItemRange(start, end, window, slot)
|
|
2003
1983
|
|
|
2004
|
-
This function
|
|
1984
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2005
1985
|
|
|
2006
1986
|
Put the item at `slot` in the specified range.
|
|
2007
1987
|
|
|
2008
1988
|
#### bot.putAway(slot)
|
|
2009
1989
|
|
|
2010
|
-
This function
|
|
1990
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2011
1991
|
|
|
2012
1992
|
Put the item at `slot` in the inventory.
|
|
2013
1993
|
|
|
@@ -2015,9 +1995,9 @@ Put the item at `slot` in the inventory.
|
|
|
2015
1995
|
|
|
2016
1996
|
Close the `window`.
|
|
2017
1997
|
|
|
2018
|
-
#### bot.transfer(options
|
|
1998
|
+
#### bot.transfer(options)
|
|
2019
1999
|
|
|
2020
|
-
This function
|
|
2000
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2021
2001
|
|
|
2022
2002
|
Transfer some kind of item from one range to an other. `options` is an object containing :
|
|
2023
2003
|
|
|
@@ -2041,9 +2021,9 @@ Open an entity with an inventory, for example a villager, returns a promise on t
|
|
|
2041
2021
|
|
|
2042
2022
|
* `entity` is the entity the bot will open
|
|
2043
2023
|
|
|
2044
|
-
#### bot.moveSlotItem(sourceSlot, destSlot
|
|
2024
|
+
#### bot.moveSlotItem(sourceSlot, destSlot)
|
|
2045
2025
|
|
|
2046
|
-
This function
|
|
2026
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2047
2027
|
|
|
2048
2028
|
Move an item from `sourceSlot` to `destSlot` in the current window.
|
|
2049
2029
|
|
|
@@ -2069,31 +2049,27 @@ This collection of apis is useful in creative mode.
|
|
|
2069
2049
|
Detecting and changing gamemodes is not implemented here,
|
|
2070
2050
|
but it is assumed and often required that the bot be in creative mode for these features to work.
|
|
2071
2051
|
|
|
2072
|
-
#### bot.creative.setInventorySlot(slot, item
|
|
2052
|
+
#### bot.creative.setInventorySlot(slot, item)
|
|
2073
2053
|
|
|
2074
|
-
This function
|
|
2054
|
+
This function returns a `Promise`, with `void` as its argument when gets fired when the servers sets the slot.
|
|
2075
2055
|
|
|
2076
2056
|
Gives the bot the specified item in the specified inventory slot.
|
|
2077
|
-
If called twice on the same slot before first callback exceeds, first callback will have an error parameter
|
|
2078
2057
|
|
|
2079
2058
|
* `slot` is in inventory window coordinates (where 36 is the first quickbar slot, etc.).
|
|
2080
2059
|
* `item` is a [prismarine-item](https://github.com/PrismarineJS/prismarine-item) instance specified with arbitrary metadata, nbtdata, etc.
|
|
2081
2060
|
If `item` is `null`, the item at the specified slot is deleted.
|
|
2082
|
-
* `callback(err)` (optional) is a callback which gets fired when the servers sets the slot
|
|
2083
2061
|
|
|
2084
2062
|
If this method changes anything, you can be notified via `bot.inventory.on("updateSlot")`.
|
|
2085
2063
|
|
|
2086
|
-
#### bot.creative.flyTo(destination
|
|
2064
|
+
#### bot.creative.flyTo(destination)
|
|
2087
2065
|
|
|
2088
|
-
This function
|
|
2066
|
+
This function returns a `Promise`, with `void` as its argument when the bot arrives at the destination.
|
|
2089
2067
|
|
|
2090
2068
|
Calls `startFlying()` and moves at a constant speed through 3d space in a straight line to the destination.
|
|
2091
2069
|
`destination` is a `Vec3`, and often the `x` and `z` coordinates will end with `.5`.
|
|
2092
2070
|
This operation will not work if there is an obstacle in the way,
|
|
2093
2071
|
so it is advised to fly very short distances at a time.
|
|
2094
2072
|
|
|
2095
|
-
When the bot arrives at the destination, `cb` is called.
|
|
2096
|
-
|
|
2097
2073
|
This method does not attempt any path finding.
|
|
2098
2074
|
It is expected that a path finding implementation will use this method to move < 2 blocks at a time.
|
|
2099
2075
|
|