mineflayer 3.10.0 → 3.12.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 +0 -2
- package/.github/workflows/ci.yml +20 -16
- package/README.md +16 -15
- package/docs/README.md +16 -15
- package/docs/api.md +50 -27
- package/docs/es/README_ES.md +1 -1
- package/docs/es/api_es.md +34 -18
- package/docs/fr/README_FR.md +1 -1
- package/docs/history.md +28 -0
- package/docs/ru/README_RU.md +1 -1
- package/docs/ru/api_ru.md +1 -1
- package/docs/tr/README_TR.md +1 -1
- package/docs/zh/README_ZH_CN.md +1 -1
- package/examples/chatterbox.js +1 -1
- package/examples/discord.js +15 -5
- package/examples/plugins/afk.js +50 -37
- package/examples/python/basic.py +2 -2
- package/examples/python/chatterbox.py +1 -1
- package/examples/screenshot-with-node-canvas-webgl/screenshot.js +2 -2
- package/index.d.ts +108 -134
- package/lib/conversions.js +1 -1
- package/lib/features.json +57 -27
- package/lib/loader.js +5 -4
- package/lib/plugins/bed.js +1 -1
- package/lib/plugins/block_actions.js +19 -7
- package/lib/plugins/blocks.js +17 -4
- package/lib/plugins/chat.js +5 -6
- package/lib/plugins/command_block.js +1 -1
- package/lib/plugins/craft.js +10 -18
- package/lib/plugins/creative.js +2 -2
- package/lib/plugins/digging.js +15 -6
- package/lib/plugins/enchantment_table.js +4 -2
- package/lib/plugins/entities.js +13 -8
- package/lib/plugins/explosion.js +3 -1
- package/lib/plugins/fishing.js +2 -2
- package/lib/plugins/game.js +55 -50
- package/lib/plugins/inventory.js +164 -40
- package/lib/plugins/physics.js +16 -5
- package/lib/plugins/place_block.js +7 -6
- package/lib/plugins/ray_trace.js +10 -0
- package/lib/plugins/simple_inventory.js +1 -1
- package/lib/plugins/sound.js +1 -1
- package/lib/plugins/spawn_point.js +1 -1
- package/lib/plugins/villager.js +57 -42
- package/lib/version.js +3 -3
- package/package.json +23 -22
package/docs/es/api_es.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
3
3
|
**Tabla de contenidos** *generado con [DocToc](https://github.com/thlorenz/doctoc)*
|
|
4
4
|
|
|
5
|
-
Esta documentación no está mantenida oficialmente, si quiere ver las últimas novedades, por favor dirijase a la documentación original: [api](api.md)
|
|
6
|
-
|
|
7
5
|
- [API](#api)
|
|
8
6
|
- [Enums](#enums)
|
|
9
7
|
- [minecraft-data](#minecraft-data)
|
|
@@ -14,7 +12,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
14
12
|
- [mcdata.instruments](#mcdatainstruments)
|
|
15
13
|
- [mcdata.biomes](#mcdatabiomes)
|
|
16
14
|
- [mcdata.entities](#mcdataentities)
|
|
17
|
-
- [
|
|
15
|
+
- [Clases](#clases)
|
|
18
16
|
- [vec3](#vec3)
|
|
19
17
|
- [mineflayer.Location](#mineflayerlocation)
|
|
20
18
|
- [Entity](#entity)
|
|
@@ -47,7 +45,10 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
47
45
|
- [enchantmentTable.enchant(choice, [callback])](#enchantmenttableenchantchoice-callback)
|
|
48
46
|
- [enchantmentTable.takeTargetItem([callback])](#enchantmenttabletaketargetitemcallback)
|
|
49
47
|
- [enchantmentTable.putTargetItem(item, [callback])](#enchantmenttableputtargetitemitem-callback)
|
|
50
|
-
|
|
48
|
+
- [enchantmentTable.putLapis(item, [callback])](#enchantmenttableputlapisitem-callback)
|
|
49
|
+
- [mineflayer.anvil](#mineflayeranvil)
|
|
50
|
+
- [anvil.combine(itemOne, itemTwo[, name, callback])](#anvilcombineitemone-itemtwo-name-callback)
|
|
51
|
+
- [anvil.combine(item[, name, callback])](#anvilcombineitem-name-callback)
|
|
51
52
|
- [villager "ready"](#villager-ready)
|
|
52
53
|
- [villager.trades](#villagertrades)
|
|
53
54
|
- [villager.trade(tradeIndex, [times], [cb])](#villagertradetradeindex-times-cb)
|
|
@@ -83,7 +84,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
83
84
|
- [bot.game.hardcore](#botgamehardcore)
|
|
84
85
|
- [bot.game.maxPlayers](#botgamemaxplayers)
|
|
85
86
|
- [bot.game.serverBrand](#botgameserverbrand)
|
|
86
|
-
- [bot.
|
|
87
|
+
- [bot.physicsEnabled](#botphysicsenabled)
|
|
87
88
|
- [bot.player](#botplayer)
|
|
88
89
|
- [bot.players](#botplayers)
|
|
89
90
|
- [bot.isRaining](#botisraining)
|
|
@@ -110,6 +111,8 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
110
111
|
- [bot.foodSaturation](#botfoodsaturation)
|
|
111
112
|
- [bot.oxygenLevel](#botoxygenlevel)
|
|
112
113
|
- [bot.physics](#botphysics)
|
|
114
|
+
- [bot.simpleClick.leftMouse (slot)](#botsimpleclickleftmouse-slot)
|
|
115
|
+
- [bot.simpleClick.rightMouse (slot)](#botsimpleclickrightmouse-slot)
|
|
113
116
|
- [bot.time.doDaylightCycle](#bottimedodaylightcycle)
|
|
114
117
|
- [bot.time.bigTime](#bottimebigtime)
|
|
115
118
|
- [bot.time.time](#bottimetime)
|
|
@@ -131,6 +134,8 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
131
134
|
- ["whisper" (username, message, translate, jsonMsg, matches)](#whisper-username-message-translate-jsonmsg-matches)
|
|
132
135
|
- ["actionBar" (jsonMsg)](#actionbar-jsonmsg)
|
|
133
136
|
- ["message" (jsonMsg, position)](#message-jsonmsg-position)
|
|
137
|
+
- ["messagestr" (message, messagePosition, jsonMsg)](#messagestr-message-messageposition-jsonmsg)
|
|
138
|
+
- ["inject_allowed"](#inject_allowed)
|
|
134
139
|
- ["login"](#login)
|
|
135
140
|
- ["spawn"](#spawn)
|
|
136
141
|
- ["respawn"](#respawn)
|
|
@@ -138,7 +143,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
138
143
|
- ["resourcePack" (url, hash)](#resourcepack-url-hash)
|
|
139
144
|
- ["title"](#title)
|
|
140
145
|
- ["rain"](#rain)
|
|
141
|
-
- ["weatherUpdate"](#
|
|
146
|
+
- ["weatherUpdate"](#weatherupdate)
|
|
142
147
|
- ["time"](#time)
|
|
143
148
|
- ["kicked" (reason, loggedIn)](#kicked-reason-loggedin)
|
|
144
149
|
- ["end"](#end)
|
|
@@ -149,8 +154,15 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
149
154
|
- ["breath"](#breath)
|
|
150
155
|
- ["entitySwingArm" (entity)](#entityswingarm-entity)
|
|
151
156
|
- ["entityHurt" (entity)](#entityhurt-entity)
|
|
157
|
+
- ["entityDead" (entity)](#entitydead-entity)
|
|
158
|
+
- ["entityTaming" (entity)](#entitytaming-entity)
|
|
159
|
+
- ["entityTamed" (entity)](#entitytamed-entity)
|
|
160
|
+
- ["entityShakingOffWater" (entity)](#entityshakingoffwater-entity)
|
|
161
|
+
- ["entityEatingGrass" (entity)](#entityeatinggrass-entity)
|
|
152
162
|
- ["entityWake" (entity)](#entitywake-entity)
|
|
153
163
|
- ["entityEat" (entity)](#entityeat-entity)
|
|
164
|
+
- ["entityCriticalEffect" (entity)](#entitycriticaleffect-entity)
|
|
165
|
+
- ["entityMagicCriticalEffect" (entity)](#entitymagiccriticaleffect-entity)
|
|
154
166
|
- ["entityCrouch" (entity)](#entitycrouch-entity)
|
|
155
167
|
- ["entityUncrouch" (entity)](#entityuncrouch-entity)
|
|
156
168
|
- ["entityEquip" (entity)](#entityequip-entity)
|
|
@@ -166,6 +178,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
166
178
|
- ["entityEffect" (entity, effect)](#entityeffect-entity-effect)
|
|
167
179
|
- ["entityEffectEnd" (entity, effect)](#entityeffectend-entity-effect)
|
|
168
180
|
- ["playerJoined" (player)](#playerjoined-player)
|
|
181
|
+
- ["playerUpdated" (player)](#playerupdated-player)
|
|
169
182
|
- ["playerLeft" (player)](#playerleft-player)
|
|
170
183
|
- ["blockUpdate" (oldBlock, newBlock)](#blockupdate-oldblock-newblock)
|
|
171
184
|
- ["blockUpdate:(x, y, z)" (oldBlock, newBlock)](#blockupdatex-y-z-oldblock-newblock)
|
|
@@ -200,6 +213,8 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
200
213
|
- ["bossBarDeleted" (bossBar)](#bossbardeleted-bossbar)
|
|
201
214
|
- ["bossBarUpdated" (bossBar)](#bossbarupdated-bossbar)
|
|
202
215
|
- ["heldItemChanged" (heldItem)](#helditemchanged-helditem)
|
|
216
|
+
- ["physicsTick" ()](#physicstick-)
|
|
217
|
+
- ["chat:name" (matches)](#chatname-matches)
|
|
203
218
|
- [Functions](#functions)
|
|
204
219
|
- [bot.blockAt(point, extraInfos=true)](#botblockatpoint-extrainfostrue)
|
|
205
220
|
- [bot.waitForChunksToLoad(cb)](#botwaitforchunkstoloadcb)
|
|
@@ -219,6 +234,10 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
219
234
|
- [bot.chat(message)](#botchatmessage)
|
|
220
235
|
- [bot.whisper(username, message)](#botwhisperusername-message)
|
|
221
236
|
- [bot.chatAddPattern(pattern, chatType, description)](#botchataddpatternpattern-chattype-description)
|
|
237
|
+
- [bot.addChatPattern(name, pattern, chatPatternOptions)](#botaddchatpatternname-pattern-chatpatternoptions)
|
|
238
|
+
- [bot.addChatPatternSet(name, patterns, chatPatternOptions)](#botaddchatpatternsetname-patterns-chatpatternoptions)
|
|
239
|
+
- [bot.removeChatPattern(name)](#botremovechatpatternname)
|
|
240
|
+
- [bot.awaitMessage(...args)](#botawaitmessageargs)
|
|
222
241
|
- [bot.setSettings(options)](#botsetsettingsoptions)
|
|
223
242
|
- [bot.loadPlugin(plugin)](#botloadpluginplugin)
|
|
224
243
|
- [bot.loadPlugins(plugins)](#botloadpluginsplugins)
|
|
@@ -227,7 +246,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
227
246
|
- [bot.isABed(bedBlock)](#botisabedbedblock)
|
|
228
247
|
- [bot.wake([cb])](#botwakecb)
|
|
229
248
|
- [bot.setControlState(control, state)](#botsetcontrolstatecontrol-state)
|
|
230
|
-
- [bot.getControlState(control)](#botgetcontrolstatecontrol
|
|
249
|
+
- [bot.getControlState(control)](#botgetcontrolstatecontrol)
|
|
231
250
|
- [bot.clearControlStates()](#botclearcontrolstates)
|
|
232
251
|
- [bot.lookAt(point, [force], [callback])](#botlookatpoint-force-callback)
|
|
233
252
|
- [bot.look(yaw, pitch, [force], [callback])](#botlookyaw-pitch-force-callback)
|
|
@@ -242,6 +261,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
242
261
|
- [bot.acceptResourcePack()](#botacceptresourcepack)
|
|
243
262
|
- [bot.denyResourcePack()](#botdenyresourcepack)
|
|
244
263
|
- [bot.placeBlock(referenceBlock, faceVector, cb)](#botplaceblockreferenceblock-facevector-cb)
|
|
264
|
+
- [bot.placeEntity(referenceBlock, faceVector)](#botplaceentityreferenceblock-facevector)
|
|
245
265
|
- [bot.activateBlock(block, [callback])](#botactivateblockblock-callback)
|
|
246
266
|
- [bot.activateEntity(entity, [callback])](#botactivateentityentity-callback)
|
|
247
267
|
- [bot.activateEntityAt(entity, position, [callback])](#botactivateentityatentity-position-callback)
|
|
@@ -251,7 +271,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
251
271
|
- [bot.deactivateItem()](#botdeactivateitem)
|
|
252
272
|
- [bot.useOn(targetEntity)](#botuseontargetentity)
|
|
253
273
|
- [bot.attack(entity)](#botattackentity)
|
|
254
|
-
- [bot.swingArm([hand])](#botswingarmhand)
|
|
274
|
+
- [bot.swingArm([hand], showHand)](#botswingarmhand-showhand)
|
|
255
275
|
- [bot.mount(entity)](#botmountentity)
|
|
256
276
|
- [bot.dismount()](#botdismount)
|
|
257
277
|
- [bot.moveVehicle(left,forward)](#botmovevehicleleftforward)
|
|
@@ -263,6 +283,7 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
263
283
|
- [bot.openFurnace(furnaceBlock)](#botopenfurnacefurnaceblock)
|
|
264
284
|
- [bot.openDispenser(dispenserBlock)](#botopendispenserdispenserblock)
|
|
265
285
|
- [bot.openEnchantmentTable(enchantmentTableBlock)](#botopenenchantmenttableenchantmenttableblock)
|
|
286
|
+
- [bot.openAnvil(anvilBlock)](#botopenanvilanvilblock)
|
|
266
287
|
- [bot.openVillager(villagerEntity)](#botopenvillagervillagerentity)
|
|
267
288
|
- [bot.trade(villagerInstance, tradeIndex, [times], [cb])](#bottradevillagerinstance-tradeindex-times-cb)
|
|
268
289
|
- [bot.setCommandBlock(pos, command, [options])](#botsetcommandblockpos-command-options)
|
|
@@ -270,8 +291,8 @@ Esta documentación no está mantenida oficialmente, si quiere ver las últimas
|
|
|
270
291
|
- [bot.waitForTicks(ticks)](#botwaitforticksticks)
|
|
271
292
|
- [Lower level inventory methods](#lower-level-inventory-methods)
|
|
272
293
|
- [bot.clickWindow(slot, mouseButton, mode, cb)](#botclickwindowslot-mousebutton-mode-cb)
|
|
273
|
-
- [bot.putSelectedItemRange(start, end, window, slot
|
|
274
|
-
- [bot.putAway(slot
|
|
294
|
+
- [bot.putSelectedItemRange(start, end, window, slot)](#botputselecteditemrangestart-end-window-slot)
|
|
295
|
+
- [bot.putAway(slot)](#botputawayslot)
|
|
275
296
|
- [bot.closeWindow(window)](#botclosewindowwindow)
|
|
276
297
|
- [bot.transfer(options, cb)](#bottransferoptions-cb)
|
|
277
298
|
- [bot.openBlock(block)](#botopenblockblock)
|
|
@@ -671,7 +692,7 @@ Crea y devuelve una instancia de la clase Bot.
|
|
|
671
692
|
* client : una instancia de node-minecraft-protocol, si no se especifíca, mineflayer creará su propio cliente. Esto sirve para usar mineflayer a través de un proxy de muchos clientes o para un cliente vanilla y un cliente mineflayer.
|
|
672
693
|
* plugins : object : el valor predeterminado es {}
|
|
673
694
|
- pluginName : false : no cargar el plugin interno con ese nombre ej. `pluginName`
|
|
674
|
-
- pluginName : true : carga el plugin interno con ese nombre ej. `pluginName` incluso si loadInternalPlugins está en false
|
|
695
|
+
- pluginName : true : carga el plugin interno con ese nombre ej. `pluginName` incluso si loadInternalPlugins está en false
|
|
675
696
|
- pluginName : función para introducir : carga un plugin de terceros (externo), anula el plugin interno con el mismo nombre ej. `pluginName`
|
|
676
697
|
* physicsEnabled : el valor predeterminado es true, si el bot debería ser afectado por las físicas, puede modificarse mediante bot.physicsEnabled
|
|
677
698
|
* [chat](#bot.settings.chat)
|
|
@@ -1914,20 +1935,15 @@ Hacer click en la ventana/interfaz actual, los detalles están en https://wiki.v
|
|
|
1914
1935
|
* mouseButton - 0 para click izquierdo, y 1 para click derecho
|
|
1915
1936
|
* mode - mineflayer solo tiene disponible el modo 0
|
|
1916
1937
|
|
|
1917
|
-
#### bot.putSelectedItemRange(start, end, window, slot
|
|
1938
|
+
#### bot.putSelectedItemRange(start, end, window, slot)
|
|
1918
1939
|
|
|
1919
1940
|
Esta función también devueve un `Promise`, con `void` como argumento al finalizar.
|
|
1920
1941
|
|
|
1921
1942
|
Mover el item en la casilla `slot` en un rango especificado
|
|
1922
1943
|
|
|
1923
|
-
|
|
1924
|
-
Puede ser útil en caso que el cliente tiene que simular la acción sin una respuesta del servidor.
|
|
1925
|
-
|
|
1926
|
-
#### bot.putAway(slot, noWaiting)
|
|
1944
|
+
#### bot.putAway(slot)
|
|
1927
1945
|
|
|
1928
1946
|
Esta función también devueve un `Promise`, con `void` como argumento al finalizar.
|
|
1929
|
-
`noWaiting` ejecuta putSelectedItemRanger con `noWaiting` en true.
|
|
1930
|
-
Puede ser útil en caso que el cliente tiene que simular la acción sin una respuesta del servidor.
|
|
1931
1947
|
|
|
1932
1948
|
Mover el item a la casilla `slot` en el inventario.
|
|
1933
1949
|
|
package/docs/fr/README_FR.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
[](https://gitpod.io/#https://github.com/PrismarineJS/mineflayer)
|
|
11
11
|
|
|
12
|
-
|
|
|
12
|
+
| <sub>EN</sub> [Anglais](../README.md) | <sub>RU</sub> [Russe](../ru/README_RU.md) | <sub>ES</sub> [Espagnol](../es/README_ES.md) | <sub>FR</sub> [Français](README_FR.md) | <sub>TR</sub> [Türkçe](../tr/README_TR.md) | <sub>ZH</sub> [Chinois](../zh/README_ZH_CN.md) |
|
|
13
13
|
|-------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|
|
|
14
14
|
|
|
15
15
|
Créé des robots Minecraft avec API stable, puissante et facilement maniable, [API](api.md).
|
package/docs/history.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## 3.12.0
|
|
2
|
+
|
|
3
|
+
* Bypass anticheats that detect sensitivity (@mat-1)
|
|
4
|
+
* Fix removing many players at once from tab list (@mat-1)
|
|
5
|
+
* Added blockAtEntityCursor function (@DatArnoGuy)
|
|
6
|
+
* add option to disable default chat patterns (@U5B)
|
|
7
|
+
* Fixed wrong arm swinging (@IceTank)
|
|
8
|
+
* Add pitch speed to look (@IceTank)
|
|
9
|
+
* Console spam fix (@IceTank)
|
|
10
|
+
* Update openVillager function to return a promise (@amoraschi)
|
|
11
|
+
* Send arm_animation before use_entity (@aesthetic0001)
|
|
12
|
+
* Add reason for the end of a mineflayer bot (@U5B)
|
|
13
|
+
* added rejection of invalid transaction packets (anticheat fix) (@U5B)
|
|
14
|
+
|
|
15
|
+
## 3.11.2
|
|
16
|
+
* Remove unnecessary and buggy inventory check in place block (@Karang)
|
|
17
|
+
* Make all events allow async cb typings (@u9g)
|
|
18
|
+
|
|
19
|
+
## 3.11.1
|
|
20
|
+
* Get rid of nowaiting (@nickelpro)
|
|
21
|
+
* update readme (@inthmafr)
|
|
22
|
+
* Fix Typings (@link-discord, @IceTank, @u9g)
|
|
23
|
+
|
|
24
|
+
## 3.11.0
|
|
25
|
+
* better chat, equipping and consuming errors (@u9g)
|
|
26
|
+
* add bot.usingHeldItem (@mat1)
|
|
27
|
+
* 1.17.1 support (mainly work from @nickelpro and @u9g, but also @Archengius @extremeheat @imharvol @willocn and @rom1504)
|
|
28
|
+
|
|
1
29
|
## 3.10.0
|
|
2
30
|
* Add Chinese translations (@Nyaasu66)
|
|
3
31
|
* Fix bot.equip failing with off-hand (@IceTank)
|
package/docs/ru/README_RU.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
[](https://gitpod.io/#https://github.com/PrismarineJS/mineflayer)
|
|
11
11
|
|
|
12
|
-
|
|
|
12
|
+
| <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
13
|
|-------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|
|
|
14
14
|
|
|
15
15
|
Создавайте ботов Minecraft с помощью мощного, стабильного и высокоуровневого JavaScript [API](api.md).
|
package/docs/ru/api_ru.md
CHANGED
|
@@ -1292,7 +1292,7 @@ function somePlugin (bot, options) {
|
|
|
1292
1292
|
bot.someFunction = someFunction
|
|
1293
1293
|
}
|
|
1294
1294
|
|
|
1295
|
-
|
|
1295
|
+
const bot = mineflayer.createBot({})
|
|
1296
1296
|
bot.loadPlugin(somePlugin)
|
|
1297
1297
|
bot.once('login', () => {
|
|
1298
1298
|
bot.someFunction() // Yay!
|
package/docs/tr/README_TR.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
[](https://gitpod.io/#https://github.com/PrismarineJS/mineflayer)
|
|
11
11
|
|
|
12
|
-
|
|
|
12
|
+
| <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
13
|
|-------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|
|
|
14
14
|
|
|
15
15
|
JavaScript ile güçlü, stabil ve üst seviye Minecraft botları oluşturabileceğiniz bir [API](api.md).
|
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
|
-
|
|
|
13
|
+
| <sub>EN</sub> [英语](../README.md) | <sub>RU</sub> [俄语](../ru/README_RU.md) | <sub>ES</sub> [西班牙语](../es/README_ES.md) | <sub>FR</sub> [法语](../fr/README_FR.md) | <sub>TR</sub> [土耳其语](../tr/README_TR.md) | <sub>ZH</sub> [中文](README_ZH_CN.md) |
|
|
14
14
|
|-------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|
|
|
15
15
|
|
|
16
16
|
使用强大、稳定、高级的JavaScript [API](../api.md) 来开发Minecraft机器人,同时支持 Python。
|
package/examples/chatterbox.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* a few informations while you are in game.
|
|
14
14
|
*/
|
|
15
15
|
const mineflayer = require('mineflayer')
|
|
16
|
-
const Vec3 = require('vec3')
|
|
16
|
+
const { Vec3 } = require('vec3')
|
|
17
17
|
|
|
18
18
|
if (process.argv.length < 4 || process.argv.length > 6) {
|
|
19
19
|
console.log('Usage : node chatterbot.js <host> <port> [<name>] [<password>]')
|
package/examples/discord.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* This example is a very simple way how to connect a discord bot with a mineflayer bot.
|
|
3
3
|
* For this example you will need discord.js installed. You can install with: npm install discord.js
|
|
4
|
-
*
|
|
4
|
+
* This example uses discord.js v13
|
|
5
5
|
* You need to do this before running this example:
|
|
6
6
|
* - You need to get a discord token
|
|
7
7
|
* - You need to get the id of the channel you want to use
|
|
@@ -12,9 +12,18 @@ if (process.argv.length < 6 || process.argv.length > 8) {
|
|
|
12
12
|
process.exit(1)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
// Load discord
|
|
16
|
-
const
|
|
17
|
-
|
|
15
|
+
// Load discord.js
|
|
16
|
+
const {
|
|
17
|
+
Client,
|
|
18
|
+
Intents
|
|
19
|
+
} = require('discord.js')
|
|
20
|
+
// Create Discord intentions, required in v13
|
|
21
|
+
const intents = new Intents(['GUILDS', 'GUILD_MESSAGES'])
|
|
22
|
+
// Create Discord client
|
|
23
|
+
const client = new Client({
|
|
24
|
+
intents: intents
|
|
25
|
+
})
|
|
26
|
+
|
|
18
27
|
let channel = process.argv[3]
|
|
19
28
|
|
|
20
29
|
// Load mineflayer
|
|
@@ -28,6 +37,7 @@ const bot = mineflayer.createBot({
|
|
|
28
37
|
|
|
29
38
|
client.on('ready', () => {
|
|
30
39
|
console.log(`The discord bot logged in! Username: ${client.user.username}!`)
|
|
40
|
+
// Find the Discord channel messages will be sent to
|
|
31
41
|
channel = client.channels.cache.get(channel)
|
|
32
42
|
if (!channel) {
|
|
33
43
|
console.log(`I could not find the channel (${process.argv[3]})!\nUsage : node discord.js <discord bot token> <channel id> <host> <port> [<name>] [<password>]`)
|
|
@@ -36,7 +46,7 @@ client.on('ready', () => {
|
|
|
36
46
|
})
|
|
37
47
|
|
|
38
48
|
// Redirect Discord messages to in-game chat
|
|
39
|
-
client.on('
|
|
49
|
+
client.on('messageCreate', message => {
|
|
40
50
|
// Only handle messages in specified channel
|
|
41
51
|
if (message.channel.id !== channel.id) return
|
|
42
52
|
// Ignore messages from the bot itself
|
package/examples/plugins/afk.js
CHANGED
|
@@ -1,37 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
bot.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
afk
|
|
37
|
-
|
|
1
|
+
/*
|
|
2
|
+
Make a function that is exported, this will be the "inject function", which is called when loading the plugin into mineflayer.
|
|
3
|
+
You can load this plugin into mineflayer in three ways:
|
|
4
|
+
|
|
5
|
+
1.
|
|
6
|
+
```
|
|
7
|
+
bot.createBot({
|
|
8
|
+
plugins: [require('./plugin')]
|
|
9
|
+
})
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
2.
|
|
13
|
+
```
|
|
14
|
+
bot.createBot({
|
|
15
|
+
plugins: {
|
|
16
|
+
afk: require('./plugin')
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
3.
|
|
22
|
+
```
|
|
23
|
+
const bot = bot.createBot()
|
|
24
|
+
bot.loadPlugin(require('./plugin'))
|
|
25
|
+
```
|
|
26
|
+
*/
|
|
27
|
+
module.exports = bot => {
|
|
28
|
+
/*
|
|
29
|
+
Inside the scope of this function, you should do anything you need to with the bot object, like add properties to it, like `bot.afk`,
|
|
30
|
+
this function will be called when this plugin is called during the login process
|
|
31
|
+
*/
|
|
32
|
+
let rotater
|
|
33
|
+
let rotated = false
|
|
34
|
+
bot.afk = {}
|
|
35
|
+
|
|
36
|
+
bot.afk.start = () => {
|
|
37
|
+
if (rotater) return
|
|
38
|
+
rotater = setInterval(rotate, 3000)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
bot.afk.stop = () => {
|
|
42
|
+
if (!rotater) return
|
|
43
|
+
clearInterval(rotater)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function rotate () {
|
|
47
|
+
bot.look(rotated ? 0 : Math.PI, 0)
|
|
48
|
+
rotated = !rotated
|
|
49
|
+
}
|
|
50
|
+
}
|
package/examples/python/basic.py
CHANGED
|
@@ -21,7 +21,7 @@ def handle(*args):
|
|
|
21
21
|
movements = pathfinder.Movements(bot, mcData)
|
|
22
22
|
|
|
23
23
|
@On(bot, 'chat')
|
|
24
|
-
def handleMsg(sender, message, *args):
|
|
24
|
+
def handleMsg(this, sender, message, *args):
|
|
25
25
|
print("Got message", sender, message)
|
|
26
26
|
if sender and (sender != BOT_USERNAME):
|
|
27
27
|
bot.chat('Hi, you said ' + message)
|
|
@@ -39,4 +39,4 @@ def handle(*args):
|
|
|
39
39
|
|
|
40
40
|
@On(bot, "end")
|
|
41
41
|
def handle(*args):
|
|
42
|
-
print("Bot ended!", args)
|
|
42
|
+
print("Bot ended!", args)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# a few informations while you are in game.
|
|
14
14
|
# ===========================================================================
|
|
15
15
|
import sys, re
|
|
16
|
-
from javascript import require, On, Once
|
|
16
|
+
from javascript import require, On, Once, console
|
|
17
17
|
|
|
18
18
|
mineflayer = require("mineflayer", "latest")
|
|
19
19
|
Vec3 = require("vec3").Vec3
|
|
@@ -11,8 +11,8 @@ global.Worker = require('worker_threads').Worker
|
|
|
11
11
|
const THREE = require('three')
|
|
12
12
|
const { createCanvas } = require('node-canvas-webgl/lib')
|
|
13
13
|
const fs = require('fs').promises
|
|
14
|
-
const Vec3 = require('vec3')
|
|
15
|
-
const EventEmitter = require('events')
|
|
14
|
+
const { Vec3 } = require('vec3')
|
|
15
|
+
const { EventEmitter } = require('events')
|
|
16
16
|
|
|
17
17
|
if (process.argv.length < 4 || process.argv.length > 6) {
|
|
18
18
|
console.log('Usage : node screenshot.js <host> <port> [<name>] [<password>]')
|