mineflayer 3.14.1 → 3.18.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/FUNDING.yml +3 -0
- package/.github/workflows/ci.yml +2 -0
- package/README.md +11 -10
- package/docs/FAQ.md +10 -2
- package/docs/README.md +11 -10
- package/docs/api.md +130 -158
- package/docs/history.md +16 -0
- package/docs/zh/CONTRIBUTING.md +93 -0
- package/docs/zh/FAQ.md +169 -0
- package/docs/zh/README_ZH_CN.md +32 -25
- package/docs/zh/_sidebar.md +9 -0
- package/docs/zh/api.md +2132 -0
- package/docs/zh/demos.md +18 -0
- package/docs/zh/history.md +914 -0
- package/docs/zh/index.html +38 -0
- package/docs/zh/tutorial.md +718 -0
- package/examples/anvil.js +10 -12
- package/examples/chest.js +14 -16
- package/examples/digger.js +25 -31
- package/examples/inventory.js +10 -12
- package/index.d.ts +57 -65
- package/lib/features.json +37 -27
- package/lib/loader.js +1 -1
- package/lib/plugins/blocks.js +70 -90
- package/lib/plugins/chat.js +12 -1
- package/lib/plugins/digging.js +12 -2
- package/lib/plugins/game.js +6 -1
- package/lib/promise_utils.js +16 -3
- package/lib/version.js +2 -2
- package/package.json +5 -5
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)](#windowdeposititemtype-metadata-count)
|
|
24
|
+
- [window.withdraw(itemType, metadata, count)](#windowwithdrawitemtype-metadata-count)
|
|
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)
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
- ["chat:name" (matches)](#chatname-matches)
|
|
236
236
|
- [Functions](#functions)
|
|
237
237
|
- [bot.blockAt(point, extraInfos=true)](#botblockatpoint-extrainfostrue)
|
|
238
|
-
- [bot.waitForChunksToLoad(
|
|
238
|
+
- [bot.waitForChunksToLoad()](#botwaitforchunkstoload)
|
|
239
239
|
- [bot.blockInSight(maxSteps, vectorLength)](#botblockinsightmaxsteps-vectorlength)
|
|
240
240
|
- [bot.blockAtCursor(maxDistance=256)](#botblockatcursormaxdistance256)
|
|
241
241
|
- [bot.blockAtEntityCursor(entity=bot.entity, maxDistance=256)](#botblockatentitycursorentitybotentity-maxdistance256)
|
|
@@ -249,7 +249,7 @@
|
|
|
249
249
|
- [Methods](#methods)
|
|
250
250
|
- [bot.end(reason)](#botendreason)
|
|
251
251
|
- [bot.quit(reason)](#botquitreason)
|
|
252
|
-
- [bot.tabComplete(str,
|
|
252
|
+
- [bot.tabComplete(str, [assumeCommand], [sendBlockInSight])](#bottabcompletestr-assumecommand-sendblockinsight)
|
|
253
253
|
- [bot.chat(message)](#botchatmessage)
|
|
254
254
|
- [bot.whisper(username, message)](#botwhisperusername-message)
|
|
255
255
|
- [bot.chatAddPattern(pattern, chatType, description)](#botchataddpatternpattern-chattype-description)
|
|
@@ -261,32 +261,32 @@
|
|
|
261
261
|
- [bot.loadPlugin(plugin)](#botloadpluginplugin)
|
|
262
262
|
- [bot.loadPlugins(plugins)](#botloadpluginsplugins)
|
|
263
263
|
- [bot.hasPlugin(plugin)](#bothaspluginplugin)
|
|
264
|
-
- [bot.sleep(bedBlock
|
|
264
|
+
- [bot.sleep(bedBlock)](#botsleepbedblock)
|
|
265
265
|
- [bot.isABed(bedBlock)](#botisabedbedblock)
|
|
266
|
-
- [bot.wake(
|
|
266
|
+
- [bot.wake()](#botwake)
|
|
267
267
|
- [bot.setControlState(control, state)](#botsetcontrolstatecontrol-state)
|
|
268
268
|
- [bot.getControlState(control)](#botgetcontrolstatecontrol)
|
|
269
269
|
- [bot.clearControlStates()](#botclearcontrolstates)
|
|
270
270
|
- [bot.getExplosionDamages(entity, position, radius, [rawDamages])](#botgetexplosiondamagesentity-position-radius-rawdamages)
|
|
271
|
-
- [bot.lookAt(point, [force]
|
|
272
|
-
- [bot.look(yaw, pitch, [force]
|
|
271
|
+
- [bot.lookAt(point, [force])](#botlookatpoint-force)
|
|
272
|
+
- [bot.look(yaw, pitch, [force])](#botlookyaw-pitch-force)
|
|
273
273
|
- [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]
|
|
274
|
+
- [bot.equip(item, destination)](#botequipitem-destination)
|
|
275
|
+
- [bot.unequip(destination)](#botunequipdestination)
|
|
276
|
+
- [bot.tossStack(item)](#bottossstackitem)
|
|
277
|
+
- [bot.toss(itemType, metadata, count)](#bottossitemtype-metadata-count)
|
|
278
|
+
- [bot.dig(block, [forceLook = true], [digFace])](#botdigblock-forcelook--true-digface)
|
|
279
279
|
- [bot.stopDigging()](#botstopdigging)
|
|
280
280
|
- [bot.digTime(block)](#botdigtimeblock)
|
|
281
281
|
- [bot.acceptResourcePack()](#botacceptresourcepack)
|
|
282
282
|
- [bot.denyResourcePack()](#botdenyresourcepack)
|
|
283
|
-
- [bot.placeBlock(referenceBlock, faceVector
|
|
283
|
+
- [bot.placeBlock(referenceBlock, faceVector)](#botplaceblockreferenceblock-facevector)
|
|
284
284
|
- [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(
|
|
285
|
+
- [bot.activateBlock(block)](#botactivateblockblock)
|
|
286
|
+
- [bot.activateEntity(entity)](#botactivateentityentity)
|
|
287
|
+
- [bot.activateEntityAt(entity, position)](#botactivateentityatentity-position)
|
|
288
|
+
- [bot.consume()](#botconsume)
|
|
289
|
+
- [bot.fish()](#botfish)
|
|
290
290
|
- [bot.activateItem(offHand=false)](#botactivateitemoffhandfalse)
|
|
291
291
|
- [bot.deactivateItem()](#botdeactivateitem)
|
|
292
292
|
- [bot.useOn(targetEntity)](#botuseontargetentity)
|
|
@@ -296,8 +296,8 @@
|
|
|
296
296
|
- [bot.dismount()](#botdismount)
|
|
297
297
|
- [bot.moveVehicle(left,forward)](#botmovevehicleleftforward)
|
|
298
298
|
- [bot.setQuickBarSlot(slot)](#botsetquickbarslotslot)
|
|
299
|
-
- [bot.craft(recipe, count, craftingTable
|
|
300
|
-
- [bot.writeBook(slot, pages
|
|
299
|
+
- [bot.craft(recipe, count, craftingTable)](#botcraftrecipe-count-craftingtable)
|
|
300
|
+
- [bot.writeBook(slot, pages)](#botwritebookslot-pages)
|
|
301
301
|
- [bot.openContainer(containerBlock or containerEntity)](#botopencontainercontainerblock-or-containerentity)
|
|
302
302
|
- [bot.openChest(chestBlock or minecartchestEntity)](#botopenchestchestblock-or-minecartchestentity)
|
|
303
303
|
- [bot.openFurnace(furnaceBlock)](#botopenfurnacefurnaceblock)
|
|
@@ -305,24 +305,24 @@
|
|
|
305
305
|
- [bot.openEnchantmentTable(enchantmentTableBlock)](#botopenenchantmenttableenchantmenttableblock)
|
|
306
306
|
- [bot.openAnvil(anvilBlock)](#botopenanvilanvilblock)
|
|
307
307
|
- [bot.openVillager(villagerEntity)](#botopenvillagervillagerentity)
|
|
308
|
-
- [bot.trade(villagerInstance, tradeIndex, [times]
|
|
308
|
+
- [bot.trade(villagerInstance, tradeIndex, [times])](#bottradevillagerinstance-tradeindex-times)
|
|
309
309
|
- [bot.setCommandBlock(pos, command, [options])](#botsetcommandblockpos-command-options)
|
|
310
310
|
- [bot.supportFeature(name)](#botsupportfeaturename)
|
|
311
311
|
- [bot.waitForTicks(ticks)](#botwaitforticksticks)
|
|
312
312
|
- [Lower level inventory methods](#lower-level-inventory-methods)
|
|
313
|
-
- [bot.clickWindow(slot, mouseButton, mode
|
|
313
|
+
- [bot.clickWindow(slot, mouseButton, mode)](#botclickwindowslot-mousebutton-mode)
|
|
314
314
|
- [bot.putSelectedItemRange(start, end, window, slot)](#botputselecteditemrangestart-end-window-slot)
|
|
315
315
|
- [bot.putAway(slot)](#botputawayslot)
|
|
316
316
|
- [bot.closeWindow(window)](#botclosewindowwindow)
|
|
317
|
-
- [bot.transfer(options
|
|
317
|
+
- [bot.transfer(options)](#bottransferoptions)
|
|
318
318
|
- [bot.openBlock(block)](#botopenblockblock)
|
|
319
319
|
- [bot.openEntity(entity)](#botopenentityentity)
|
|
320
|
-
- [bot.moveSlotItem(sourceSlot, destSlot
|
|
320
|
+
- [bot.moveSlotItem(sourceSlot, destSlot)](#botmoveslotitemsourceslot-destslot)
|
|
321
321
|
- [bot.updateHeldItem()](#botupdatehelditem)
|
|
322
322
|
- [bot.getEquipmentDestSlot(destination)](#botgetequipmentdestslotdestination)
|
|
323
323
|
- [bot.creative](#botcreative)
|
|
324
|
-
- [bot.creative.setInventorySlot(slot, item
|
|
325
|
-
- [bot.creative.flyTo(destination
|
|
324
|
+
- [bot.creative.setInventorySlot(slot, item)](#botcreativesetinventoryslotslot-item)
|
|
325
|
+
- [bot.creative.flyTo(destination)](#botcreativeflytodestination)
|
|
326
326
|
- [bot.creative.startFlying()](#botcreativestartflying)
|
|
327
327
|
- [bot.creative.stopFlying()](#botcreativestopflying)
|
|
328
328
|
|
|
@@ -418,23 +418,21 @@ See [prismarine-item](https://github.com/PrismarineJS/prismarine-item)
|
|
|
418
418
|
|
|
419
419
|
See [prismarine-windows](https://github.com/PrismarineJS/prismarine-windows)
|
|
420
420
|
|
|
421
|
-
#### window.deposit(itemType, metadata, count
|
|
421
|
+
#### window.deposit(itemType, metadata, count)
|
|
422
422
|
|
|
423
|
-
This function
|
|
423
|
+
This function returns a `Promise`, with `void` as its argument when done depositing.
|
|
424
424
|
|
|
425
425
|
* `itemType` - numerical item id
|
|
426
426
|
* `metadata` - numerical value. `null` means match anything.
|
|
427
427
|
* `count` - how many to deposit. `null` is an alias to 1.
|
|
428
|
-
* `callback(err)` - (optional) - called when done depositing
|
|
429
428
|
|
|
430
|
-
#### window.withdraw(itemType, metadata, count
|
|
429
|
+
#### window.withdraw(itemType, metadata, count)
|
|
431
430
|
|
|
432
|
-
This function
|
|
431
|
+
This function returns a `Promise`, with `void` as its argument when done withdrawing.
|
|
433
432
|
|
|
434
433
|
* `itemType` - numerical item id
|
|
435
434
|
* `metadata` - numerical value. `null` means match anything.
|
|
436
435
|
* `count` - how many to withdraw. `null` is an alias to 1.
|
|
437
|
-
* `callback(err)` - (optional) - called when done withdrawing
|
|
438
436
|
|
|
439
437
|
#### window.close()
|
|
440
438
|
|
|
@@ -456,31 +454,28 @@ See `bot.openFurnace(furnaceBlock)`.
|
|
|
456
454
|
|
|
457
455
|
Fires when `furnace.fuel` and/or `furnace.progress` update.
|
|
458
456
|
|
|
459
|
-
#### furnace.takeInput(
|
|
457
|
+
#### furnace.takeInput()
|
|
460
458
|
|
|
461
|
-
This function
|
|
459
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
462
460
|
|
|
463
|
-
* `callback(err, item)`
|
|
464
461
|
|
|
465
|
-
#### furnace.takeFuel(
|
|
462
|
+
#### furnace.takeFuel()
|
|
466
463
|
|
|
467
|
-
This function
|
|
464
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
468
465
|
|
|
469
|
-
* `callback(err, item)`
|
|
470
466
|
|
|
471
|
-
#### furnace.takeOutput(
|
|
467
|
+
#### furnace.takeOutput()
|
|
472
468
|
|
|
473
|
-
This function
|
|
469
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
474
470
|
|
|
475
|
-
* `callback(err, item)`
|
|
476
471
|
|
|
477
|
-
#### furnace.putInput(itemType, metadata, count
|
|
472
|
+
#### furnace.putInput(itemType, metadata, count)
|
|
478
473
|
|
|
479
|
-
This function
|
|
474
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
480
475
|
|
|
481
|
-
#### furnace.putFuel(itemType, metadata, count
|
|
476
|
+
#### furnace.putFuel(itemType, metadata, count)
|
|
482
477
|
|
|
483
|
-
This function
|
|
478
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
484
479
|
|
|
485
480
|
#### furnace.inputItem()
|
|
486
481
|
|
|
@@ -542,47 +537,41 @@ Looks like:
|
|
|
542
537
|
]
|
|
543
538
|
```
|
|
544
539
|
|
|
545
|
-
#### enchantmentTable.enchant(choice
|
|
540
|
+
#### enchantmentTable.enchant(choice)
|
|
546
541
|
|
|
547
|
-
This function
|
|
542
|
+
This function returns a `Promise`, with `item` as its argument when the item has been enchanted.
|
|
548
543
|
|
|
549
544
|
* `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
545
|
|
|
552
|
-
#### enchantmentTable.takeTargetItem(
|
|
546
|
+
#### enchantmentTable.takeTargetItem()
|
|
553
547
|
|
|
554
|
-
This function
|
|
548
|
+
This function returns a `Promise`, with `item` as its argument upon completion.
|
|
555
549
|
|
|
556
|
-
* `callback(err, item)`
|
|
557
550
|
|
|
558
|
-
#### enchantmentTable.putTargetItem(item
|
|
551
|
+
#### enchantmentTable.putTargetItem(item)
|
|
559
552
|
|
|
560
|
-
This function
|
|
553
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
561
554
|
|
|
562
|
-
* `callback(err)`
|
|
563
555
|
|
|
564
|
-
#### enchantmentTable.putLapis(item
|
|
556
|
+
#### enchantmentTable.putLapis(item)
|
|
565
557
|
|
|
566
|
-
This function
|
|
558
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
567
559
|
|
|
568
|
-
* `callback(err)`
|
|
569
560
|
|
|
570
561
|
### mineflayer.anvil
|
|
571
562
|
|
|
572
563
|
Extends windows.Window for anvils
|
|
573
564
|
See `bot.openAnvil(anvilBlock)`.
|
|
574
565
|
|
|
575
|
-
#### anvil.combine(itemOne, itemTwo[, name
|
|
566
|
+
#### anvil.combine(itemOne, itemTwo[, name])
|
|
576
567
|
|
|
577
|
-
This function
|
|
568
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
578
569
|
|
|
579
|
-
* `callback(err)` - in order to use callback, pass an empty string ('') for name
|
|
580
570
|
|
|
581
|
-
#### anvil.combine(item[, name
|
|
571
|
+
#### anvil.combine(item[, name])
|
|
582
572
|
|
|
583
|
-
This function
|
|
573
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
584
574
|
|
|
585
|
-
* `callback(err)`
|
|
586
575
|
|
|
587
576
|
#### villager "ready"
|
|
588
577
|
|
|
@@ -626,8 +615,8 @@ Looks like:
|
|
|
626
615
|
]
|
|
627
616
|
```
|
|
628
617
|
|
|
629
|
-
#### villager.trade(tradeIndex, [times]
|
|
630
|
-
Is the same as [bot.trade(villagerInstance, tradeIndex, [times]
|
|
618
|
+
#### villager.trade(tradeIndex, [times])
|
|
619
|
+
Is the same as [bot.trade(villagerInstance, tradeIndex, [times])](#bottradevillagerinstance-tradeindex-times)
|
|
631
620
|
|
|
632
621
|
### mineflayer.ScoreBoard
|
|
633
622
|
|
|
@@ -818,6 +807,14 @@ Whether the bot is using the item that it's holding, for example eating food or
|
|
|
818
807
|
|
|
819
808
|
#### bot.game.serverBrand
|
|
820
809
|
|
|
810
|
+
#### bot.game.minY
|
|
811
|
+
|
|
812
|
+
minimum y of the world
|
|
813
|
+
|
|
814
|
+
#### bot.game.height
|
|
815
|
+
|
|
816
|
+
world height
|
|
817
|
+
|
|
821
818
|
### bot.physicsEnabled
|
|
822
819
|
|
|
823
820
|
Enable physics, default true.
|
|
@@ -1432,11 +1429,9 @@ Fires when the all of a chat pattern's regexs have matches
|
|
|
1432
1429
|
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).
|
|
1433
1430
|
See `Block`.
|
|
1434
1431
|
|
|
1435
|
-
#### bot.waitForChunksToLoad(
|
|
1436
|
-
|
|
1437
|
-
This function also returns a `Promise`, with `void` as its argument upon completion.
|
|
1432
|
+
#### bot.waitForChunksToLoad()
|
|
1438
1433
|
|
|
1439
|
-
|
|
1434
|
+
This function returns a `Promise`, with `void` as its argument when many chunks have loaded.
|
|
1440
1435
|
|
|
1441
1436
|
#### bot.blockInSight(maxSteps, vectorLength)
|
|
1442
1437
|
|
|
@@ -1521,14 +1516,12 @@ End the connection with the server.
|
|
|
1521
1516
|
|
|
1522
1517
|
Gracefully disconnect from the server with the given reason (defaults to 'disconnect.quitting').
|
|
1523
1518
|
|
|
1524
|
-
#### bot.tabComplete(str,
|
|
1519
|
+
#### bot.tabComplete(str, [assumeCommand], [sendBlockInSight])
|
|
1525
1520
|
|
|
1526
|
-
This function
|
|
1521
|
+
This function returns a `Promise`, with `matches` as its argument upon completion.
|
|
1527
1522
|
|
|
1528
1523
|
Requests chat completion from the server.
|
|
1529
1524
|
* `str` - String to complete.
|
|
1530
|
-
* `callback(matches)`
|
|
1531
|
-
- `matches` - Array of matching strings.
|
|
1532
1525
|
* `assumeCommand` - Field sent to server, defaults to false.
|
|
1533
1526
|
* `sendBlockInSight` - Field sent to server, defaults to true. Set this option to false if you want more performance.
|
|
1534
1527
|
|
|
@@ -1636,21 +1629,21 @@ Injects plugins see `bot.loadPlugin`.
|
|
|
1636
1629
|
|
|
1637
1630
|
Checks if the given plugin is loaded (or scheduled to be loaded) on this bot.
|
|
1638
1631
|
|
|
1639
|
-
#### bot.sleep(bedBlock
|
|
1632
|
+
#### bot.sleep(bedBlock)
|
|
1640
1633
|
|
|
1641
|
-
This function
|
|
1634
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1642
1635
|
|
|
1643
|
-
Sleep in a bed. `bedBlock` should be a `Block` instance which is a bed.
|
|
1636
|
+
Sleep in a bed. `bedBlock` should be a `Block` instance which is a bed.
|
|
1644
1637
|
|
|
1645
1638
|
#### bot.isABed(bedBlock)
|
|
1646
1639
|
|
|
1647
1640
|
Return true if `bedBlock` is a bed
|
|
1648
1641
|
|
|
1649
|
-
#### bot.wake(
|
|
1642
|
+
#### bot.wake()
|
|
1650
1643
|
|
|
1651
|
-
This function
|
|
1644
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1652
1645
|
|
|
1653
|
-
Get out of bed.
|
|
1646
|
+
Get out of bed.
|
|
1654
1647
|
|
|
1655
1648
|
#### bot.setControlState(control, state)
|
|
1656
1649
|
|
|
@@ -1681,17 +1674,16 @@ It will return `null` if the entity has no armor and rawDamages is not set to tr
|
|
|
1681
1674
|
* `radius` - the explosion radius as a number
|
|
1682
1675
|
* `rawDamages` - optional, if true it ignores armor in the calculation
|
|
1683
1676
|
|
|
1684
|
-
#### bot.lookAt(point, [force]
|
|
1677
|
+
#### bot.lookAt(point, [force])
|
|
1685
1678
|
|
|
1686
|
-
This function
|
|
1679
|
+
This function returns a `Promise`, with `void` as its argument when you are looking at `point`.
|
|
1687
1680
|
|
|
1688
1681
|
* `point` [Vec3](https://github.com/andrewrk/node-vec3) instance - tilts your head so that it is directly facing this point.
|
|
1689
1682
|
* `force` - See `force` in `bot.look`
|
|
1690
|
-
* `callback()` optional, called when you are looking at `point`
|
|
1691
1683
|
|
|
1692
|
-
#### bot.look(yaw, pitch, [force]
|
|
1684
|
+
#### bot.look(yaw, pitch, [force])
|
|
1693
1685
|
|
|
1694
|
-
This function
|
|
1686
|
+
This function returns a `Promise`, with `void` as its argument called when you are looking at `yaw` and `pitch`.
|
|
1695
1687
|
|
|
1696
1688
|
Set the direction your head is facing.
|
|
1697
1689
|
|
|
@@ -1703,15 +1695,14 @@ Set the direction your head is facing.
|
|
|
1703
1695
|
Specify this to true if you need the server to know exactly where you
|
|
1704
1696
|
are looking, such as for dropping items or shooting arrows. This is not
|
|
1705
1697
|
needed for client-side calculation such as walking direction.
|
|
1706
|
-
* `callback()` optional, called when you are looking at `yaw` and `pitch`
|
|
1707
1698
|
|
|
1708
1699
|
#### bot.updateSign(block, text)
|
|
1709
1700
|
|
|
1710
1701
|
Changes the text on the sign.
|
|
1711
1702
|
|
|
1712
|
-
#### bot.equip(item, destination
|
|
1703
|
+
#### bot.equip(item, destination)
|
|
1713
1704
|
|
|
1714
|
-
This function
|
|
1705
|
+
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.
|
|
1715
1706
|
|
|
1716
1707
|
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).
|
|
1717
1708
|
|
|
@@ -1723,36 +1714,32 @@ Equips an item from your inventory. If the argument `item` is of Instance `Item`
|
|
|
1723
1714
|
- `"legs"`
|
|
1724
1715
|
- `"feet"`
|
|
1725
1716
|
- `"off-hand"` - when available
|
|
1726
|
-
* `callback(error)` - optional. called when you have successfully equipped
|
|
1727
|
-
the item or when you learn that you have failed to equip the item.
|
|
1728
1717
|
|
|
1729
|
-
#### bot.unequip(destination
|
|
1718
|
+
#### bot.unequip(destination)
|
|
1730
1719
|
|
|
1731
|
-
This function
|
|
1720
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1732
1721
|
|
|
1733
1722
|
Remove an article of equipment.
|
|
1734
1723
|
|
|
1735
|
-
#### bot.tossStack(item
|
|
1724
|
+
#### bot.tossStack(item)
|
|
1736
1725
|
|
|
1737
|
-
This function
|
|
1726
|
+
This function returns a `Promise`, with `void` as its argument when tossing is done.
|
|
1738
1727
|
|
|
1739
1728
|
* `item` - the stack of items you wish to toss
|
|
1740
|
-
* `callback(error)` - optional, called when tossing is done. if error is
|
|
1741
1729
|
truthy, you were not able to complete the toss.
|
|
1742
1730
|
|
|
1743
|
-
#### bot.toss(itemType, metadata, count
|
|
1731
|
+
#### bot.toss(itemType, metadata, count)
|
|
1744
1732
|
|
|
1745
|
-
This function
|
|
1733
|
+
This function returns a `Promise`, with `void` as its argument once tossing is complete.
|
|
1746
1734
|
|
|
1747
1735
|
* `itemType` - numerical id of the item you wish to toss
|
|
1748
1736
|
* `metadata` - metadata of the item you wish to toss. Use `null`
|
|
1749
1737
|
to match any metadata
|
|
1750
1738
|
* `count` - how many you want to toss. `null` is an alias for `1`.
|
|
1751
|
-
* `callback(err)` - (optional) called once tossing is complete
|
|
1752
1739
|
|
|
1753
|
-
#### bot.dig(block, [forceLook = true], [digFace]
|
|
1740
|
+
#### bot.dig(block, [forceLook = true], [digFace])
|
|
1754
1741
|
|
|
1755
|
-
This function
|
|
1742
|
+
This function returns a `Promise`, with `void` as its argument when the block is broken or you are interrupted.
|
|
1756
1743
|
|
|
1757
1744
|
Begin digging into `block` with the currently equipped item.
|
|
1758
1745
|
See also "diggingCompleted" and "diggingAborted" events.
|
|
@@ -1765,8 +1752,6 @@ dig any other blocks until the block has been broken, or you call
|
|
|
1765
1752
|
* `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.
|
|
1766
1753
|
* `digFace` - (optional) Default is 'auto' looks at the center of the block and mines the top face. Can also be a vec3 vector
|
|
1767
1754
|
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.
|
|
1768
|
-
* `callback(err)` - (optional) called when the block is broken or you
|
|
1769
|
-
are interrupted.
|
|
1770
1755
|
|
|
1771
1756
|
If you call bot.dig twice before the first dig is finished, you will get a fatal 'diggingAborted' error.
|
|
1772
1757
|
|
|
@@ -1784,20 +1769,19 @@ Accepts resource pack.
|
|
|
1784
1769
|
|
|
1785
1770
|
Denies resource pack.
|
|
1786
1771
|
|
|
1787
|
-
#### bot.placeBlock(referenceBlock, faceVector
|
|
1772
|
+
#### bot.placeBlock(referenceBlock, faceVector)
|
|
1788
1773
|
|
|
1789
|
-
This function
|
|
1774
|
+
This function returns a `Promise`, with `void` as its argument when the server confirms that the block has indeed been placed.
|
|
1790
1775
|
|
|
1791
1776
|
* `referenceBlock` - the block you want to place a new block next to
|
|
1792
1777
|
* `faceVector` - one of the six cardinal directions, such as `new Vec3(0, 1, 0)` for the top face,
|
|
1793
1778
|
indicating which face of the `referenceBlock` to place the block against.
|
|
1794
|
-
* `cb` will be called when the server confirms that the block has indeed been placed
|
|
1795
1779
|
|
|
1796
1780
|
The new block will be placed at `referenceBlock.position.plus(faceVector)`.
|
|
1797
1781
|
|
|
1798
1782
|
#### bot.placeEntity(referenceBlock, faceVector)
|
|
1799
1783
|
|
|
1800
|
-
This function
|
|
1784
|
+
This function returns a `Promise`, with `Entity` as its argument upon completion.
|
|
1801
1785
|
|
|
1802
1786
|
* `referenceBlock` - the block you want to place the entity next to
|
|
1803
1787
|
* `faceVector` - one of the six cardinal directions, such as `new Vec3(0, 1, 0)` for the top face,
|
|
@@ -1805,49 +1789,44 @@ This function also returns a `Promise`, with `Entity` as its argument upon compl
|
|
|
1805
1789
|
|
|
1806
1790
|
The new block will be placed at `referenceBlock.position.plus(faceVector)`.
|
|
1807
1791
|
|
|
1808
|
-
#### bot.activateBlock(block
|
|
1792
|
+
#### bot.activateBlock(block)
|
|
1809
1793
|
|
|
1810
|
-
This function
|
|
1794
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1811
1795
|
|
|
1812
1796
|
Punch a note block, open a door, etc.
|
|
1813
1797
|
|
|
1814
1798
|
* `block` - the block to activate
|
|
1815
|
-
* `callback(err)` - (optional) called when the block has been activated
|
|
1816
1799
|
|
|
1817
|
-
#### bot.activateEntity(entity
|
|
1800
|
+
#### bot.activateEntity(entity)
|
|
1818
1801
|
|
|
1819
|
-
This function
|
|
1802
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1820
1803
|
|
|
1821
1804
|
Activate an entity, useful for villager for example.
|
|
1822
1805
|
|
|
1823
1806
|
* `entity` - the entity to activate
|
|
1824
|
-
* `callback(err)` - (optional) called when the entity has been activated
|
|
1825
1807
|
|
|
1826
|
-
#### bot.activateEntityAt(entity, position
|
|
1808
|
+
#### bot.activateEntityAt(entity, position)
|
|
1827
1809
|
|
|
1828
|
-
This function
|
|
1810
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1829
1811
|
|
|
1830
1812
|
Activate an entity at the given position, useful for armor stands.
|
|
1831
1813
|
|
|
1832
1814
|
* `entity` - the entity to activate
|
|
1833
1815
|
* `position` - the world position to click at
|
|
1834
|
-
* `callback(err)` - (optional) called when the entity has been activated
|
|
1835
1816
|
|
|
1836
|
-
#### bot.consume(
|
|
1817
|
+
#### bot.consume()
|
|
1837
1818
|
|
|
1838
|
-
This function
|
|
1819
|
+
This function returns a `Promise`, with `void` as its argument when consume ends.
|
|
1839
1820
|
|
|
1840
1821
|
Eat / drink currently held item
|
|
1841
1822
|
|
|
1842
|
-
* `callback(error)` - called when consume ends
|
|
1843
1823
|
|
|
1844
|
-
#### bot.fish(
|
|
1824
|
+
#### bot.fish()
|
|
1845
1825
|
|
|
1846
|
-
This function
|
|
1826
|
+
This function returns a `Promise`, with `void` as its argument when fishing ends.
|
|
1847
1827
|
|
|
1848
1828
|
Use fishing rod
|
|
1849
1829
|
|
|
1850
|
-
* `callback(error)` - called when fishing ends
|
|
1851
1830
|
|
|
1852
1831
|
#### bot.activateItem(offHand=false)
|
|
1853
1832
|
|
|
@@ -1898,9 +1877,9 @@ All the direction are relative to where the bot is looking at
|
|
|
1898
1877
|
|
|
1899
1878
|
* `slot` - 0-8 the quick bar slot to select.
|
|
1900
1879
|
|
|
1901
|
-
#### bot.craft(recipe, count, craftingTable
|
|
1880
|
+
#### bot.craft(recipe, count, craftingTable)
|
|
1902
1881
|
|
|
1903
|
-
This function
|
|
1882
|
+
This function returns a `Promise`, with `void` as its argument when the crafting is complete and your inventory is updated.
|
|
1904
1883
|
|
|
1905
1884
|
* `recipe` - A `Recipe` instance. See `bot.recipesFor`.
|
|
1906
1885
|
* `count` - How many times you wish to perform the operation.
|
|
@@ -1909,16 +1888,13 @@ This function also returns a `Promise`, with `void` as its argument upon complet
|
|
|
1909
1888
|
* `craftingTable` - A `Block` instance, the crafting table you wish to
|
|
1910
1889
|
use. If the recipe does not require a crafting table, you may use
|
|
1911
1890
|
`null` for this argument.
|
|
1912
|
-
* `callback` - (optional) Called when the crafting is complete and your
|
|
1913
|
-
inventory is updated.
|
|
1914
1891
|
|
|
1915
|
-
#### bot.writeBook(slot, pages
|
|
1892
|
+
#### bot.writeBook(slot, pages)
|
|
1916
1893
|
|
|
1917
|
-
This function
|
|
1894
|
+
This function returns a `Promise`, with `void` as its argument when the writing was successfully or an error occurred.
|
|
1918
1895
|
|
|
1919
1896
|
* `slot` is in inventory window coordinates (where 36 is the first quickbar slot, etc.).
|
|
1920
1897
|
* `pages` is an array of strings represents the pages.
|
|
1921
|
-
* `callback(error)` - optional. called when the writing was successfully or an error occurred.
|
|
1922
1898
|
|
|
1923
1899
|
#### bot.openContainer(containerBlock or containerEntity)
|
|
1924
1900
|
|
|
@@ -1950,9 +1926,9 @@ Returns a promise on an `anvil` instance which represents the anvil you are open
|
|
|
1950
1926
|
Returns a promise on a `Villager` instance which represents the trading window you are opening.
|
|
1951
1927
|
You can listen to the `ready` event on this `Villager` to know when it's ready
|
|
1952
1928
|
|
|
1953
|
-
#### bot.trade(villagerInstance, tradeIndex, [times]
|
|
1929
|
+
#### bot.trade(villagerInstance, tradeIndex, [times])
|
|
1954
1930
|
|
|
1955
|
-
This function
|
|
1931
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1956
1932
|
|
|
1957
1933
|
Uses the open `villagerInstance` to trade.
|
|
1958
1934
|
|
|
@@ -1985,21 +1961,21 @@ This is a promise-based function that waits for a given number of in-game ticks
|
|
|
1985
1961
|
|
|
1986
1962
|
These are lower level methods for the inventory, they can be useful sometimes but prefer the inventory methods presented above if you can.
|
|
1987
1963
|
|
|
1988
|
-
#### bot.clickWindow(slot, mouseButton, mode
|
|
1964
|
+
#### bot.clickWindow(slot, mouseButton, mode)
|
|
1989
1965
|
|
|
1990
|
-
This function
|
|
1966
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1991
1967
|
|
|
1992
1968
|
Click on the current window. See details at https://wiki.vg/Protocol#Click_Window
|
|
1993
1969
|
|
|
1994
1970
|
#### bot.putSelectedItemRange(start, end, window, slot)
|
|
1995
1971
|
|
|
1996
|
-
This function
|
|
1972
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
1997
1973
|
|
|
1998
1974
|
Put the item at `slot` in the specified range.
|
|
1999
1975
|
|
|
2000
1976
|
#### bot.putAway(slot)
|
|
2001
1977
|
|
|
2002
|
-
This function
|
|
1978
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2003
1979
|
|
|
2004
1980
|
Put the item at `slot` in the inventory.
|
|
2005
1981
|
|
|
@@ -2007,9 +1983,9 @@ Put the item at `slot` in the inventory.
|
|
|
2007
1983
|
|
|
2008
1984
|
Close the `window`.
|
|
2009
1985
|
|
|
2010
|
-
#### bot.transfer(options
|
|
1986
|
+
#### bot.transfer(options)
|
|
2011
1987
|
|
|
2012
|
-
This function
|
|
1988
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2013
1989
|
|
|
2014
1990
|
Transfer some kind of item from one range to an other. `options` is an object containing :
|
|
2015
1991
|
|
|
@@ -2033,9 +2009,9 @@ Open an entity with an inventory, for example a villager, returns a promise on t
|
|
|
2033
2009
|
|
|
2034
2010
|
* `entity` is the entity the bot will open
|
|
2035
2011
|
|
|
2036
|
-
#### bot.moveSlotItem(sourceSlot, destSlot
|
|
2012
|
+
#### bot.moveSlotItem(sourceSlot, destSlot)
|
|
2037
2013
|
|
|
2038
|
-
This function
|
|
2014
|
+
This function returns a `Promise`, with `void` as its argument upon completion.
|
|
2039
2015
|
|
|
2040
2016
|
Move an item from `sourceSlot` to `destSlot` in the current window.
|
|
2041
2017
|
|
|
@@ -2061,31 +2037,27 @@ This collection of apis is useful in creative mode.
|
|
|
2061
2037
|
Detecting and changing gamemodes is not implemented here,
|
|
2062
2038
|
but it is assumed and often required that the bot be in creative mode for these features to work.
|
|
2063
2039
|
|
|
2064
|
-
#### bot.creative.setInventorySlot(slot, item
|
|
2040
|
+
#### bot.creative.setInventorySlot(slot, item)
|
|
2065
2041
|
|
|
2066
|
-
This function
|
|
2042
|
+
This function returns a `Promise`, with `void` as its argument when gets fired when the servers sets the slot.
|
|
2067
2043
|
|
|
2068
2044
|
Gives the bot the specified item in the specified inventory slot.
|
|
2069
|
-
If called twice on the same slot before first callback exceeds, first callback will have an error parameter
|
|
2070
2045
|
|
|
2071
2046
|
* `slot` is in inventory window coordinates (where 36 is the first quickbar slot, etc.).
|
|
2072
2047
|
* `item` is a [prismarine-item](https://github.com/PrismarineJS/prismarine-item) instance specified with arbitrary metadata, nbtdata, etc.
|
|
2073
2048
|
If `item` is `null`, the item at the specified slot is deleted.
|
|
2074
|
-
* `callback(err)` (optional) is a callback which gets fired when the servers sets the slot
|
|
2075
2049
|
|
|
2076
2050
|
If this method changes anything, you can be notified via `bot.inventory.on("updateSlot")`.
|
|
2077
2051
|
|
|
2078
|
-
#### bot.creative.flyTo(destination
|
|
2052
|
+
#### bot.creative.flyTo(destination)
|
|
2079
2053
|
|
|
2080
|
-
This function
|
|
2054
|
+
This function returns a `Promise`, with `void` as its argument when the bot arrives at the destination.
|
|
2081
2055
|
|
|
2082
2056
|
Calls `startFlying()` and moves at a constant speed through 3d space in a straight line to the destination.
|
|
2083
2057
|
`destination` is a `Vec3`, and often the `x` and `z` coordinates will end with `.5`.
|
|
2084
2058
|
This operation will not work if there is an obstacle in the way,
|
|
2085
2059
|
so it is advised to fly very short distances at a time.
|
|
2086
2060
|
|
|
2087
|
-
When the bot arrives at the destination, `cb` is called.
|
|
2088
|
-
|
|
2089
2061
|
This method does not attempt any path finding.
|
|
2090
2062
|
It is expected that a path finding implementation will use this method to move < 2 blocks at a time.
|
|
2091
2063
|
|