mineflayer 3.15.0 → 4.0.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/README.md +2 -5
- package/docs/FAQ.md +10 -2
- package/docs/README.md +2 -5
- package/docs/api.md +122 -158
- package/docs/es/README_ES.md +6 -6
- package/docs/history.md +17 -0
- package/docs/zh/README_ZH_CN.md +27 -20
- 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 +45 -58
- package/lib/features.json +5 -0
- package/lib/plugins/anvil.js +4 -4
- package/lib/plugins/bed.js +2 -3
- package/lib/plugins/blocks.js +43 -79
- package/lib/plugins/book.js +4 -5
- package/lib/plugins/chat.js +1 -9
- 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 +1 -14
- 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 +14 -14
- package/lib/plugins/physics.js +5 -5
- package/lib/plugins/place_block.js +2 -2
- package/lib/plugins/simple_inventory.js +4 -5
- package/lib/plugins/villager.js +2 -3
- package/lib/promise_utils.js +0 -11
- package/package.json +4 -4
package/docs/es/README_ES.md
CHANGED
|
@@ -17,7 +17,7 @@ Crea bots para Minecraft con una API de JavaScript potente, estable y de alto ni
|
|
|
17
17
|
|
|
18
18
|
## Características
|
|
19
19
|
|
|
20
|
-
* Soporta Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15 y 1.
|
|
20
|
+
* Soporta Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17 y 1.18.
|
|
21
21
|
* Rastreo e información de entidades.
|
|
22
22
|
* Información sobre bloques. Puedes solicitar información de todo lo que te rodea. Encuentra bloques en milisegundos
|
|
23
23
|
* Físicas y movimientos básicos - maneja todos los cuadros de colisión
|
|
@@ -34,6 +34,7 @@ Crea bots para Minecraft con una API de JavaScript potente, estable y de alto ni
|
|
|
34
34
|
Echa un vistazo a nuestros [proyectos actuales](https://github.com/PrismarineJS/mineflayer/wiki/Big-Prismarine-projects)
|
|
35
35
|
|
|
36
36
|
## Instalación
|
|
37
|
+
Primero instala Node.js >= 14 desde [nodejs.org](https://nodejs.org/)
|
|
37
38
|
|
|
38
39
|
`npm install mineflayer`
|
|
39
40
|
|
|
@@ -66,10 +67,9 @@ Si quieres aprender más, puedes mirar [aquí, ](https://www.youtube.com/playlis
|
|
|
66
67
|
|
|
67
68
|
**Empezando**
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
Por ejemplo `version:" 1.8 "`.
|
|
70
|
+
Si no se especifica una versión, la versión del servidor se detectará automáticamente. Si no se especifica ningún tipo de autenticación, se utilizará el login de Mojang automáticamente.
|
|
71
71
|
|
|
72
|
-
### Ejemplo
|
|
72
|
+
### Ejemplo: echo
|
|
73
73
|
```js
|
|
74
74
|
const mineflayer = require('mineflayer')
|
|
75
75
|
|
|
@@ -92,7 +92,7 @@ bot.on('kicked', (reason, loggedIn) => console.log(reason, loggedIn))
|
|
|
92
92
|
bot.on('error', err => console.log(err))
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
### Mira lo que tu bot
|
|
95
|
+
### Mira lo que hace tu bot
|
|
96
96
|
|
|
97
97
|
Gracias al proyecto [prismarine-viewer](https://github.com/PrismarineJS/prismarine-viewer), puedes ver en una pestaña del navegador qué está haciendo tu bot.
|
|
98
98
|
Solo tienes que ejecutar `npm install prismarine-viewer` y añadir lo siguiente a tu bot:
|
|
@@ -124,7 +124,7 @@ Más ejemplos en la carpeta de [ejemplos](https://github.com/PrismarineJS/minefl
|
|
|
124
124
|
|
|
125
125
|
### Módulos
|
|
126
126
|
|
|
127
|
-
La mayoría del desarrollo se
|
|
127
|
+
La mayoría del desarrollo se está produciendo dentro de pequeños módulos npm que son usados por mineflayer
|
|
128
128
|
|
|
129
129
|
#### The Node Way™
|
|
130
130
|
|
package/docs/history.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 4.0.0
|
|
2
|
+
|
|
3
|
+
* useEntity maintains sneak state
|
|
4
|
+
* BREAKING: remove all callbacks in favor of promises
|
|
5
|
+
|
|
6
|
+
## 3.18.0
|
|
7
|
+
|
|
8
|
+
* remove callbacks from types and docs
|
|
9
|
+
|
|
10
|
+
## 3.17.0
|
|
11
|
+
|
|
12
|
+
* callback are now depreciated with mineflayer. Any use of them will print a warning
|
|
13
|
+
|
|
14
|
+
## 3.16.0
|
|
15
|
+
|
|
16
|
+
* Use prismarine-chunk for block entities
|
|
17
|
+
|
|
1
18
|
## 3.15.0
|
|
2
19
|
|
|
3
20
|
* Supports 1.18
|
package/docs/zh/README_ZH_CN.md
CHANGED
|
@@ -10,27 +10,26 @@
|
|
|
10
10
|
[](https://gitpod.io/#https://github.com/PrismarineJS/mineflayer)
|
|
11
11
|
[](https://colab.research.google.com/github/PrismarineJS/mineflayer/blob/master/docs/mineflayer.ipynb)
|
|
12
12
|
|
|
13
|
-
| <sub>EN</sub> [
|
|
13
|
+
| <sub>EN</sub> [English](README.md) | <sub>RU</sub> [русский](ru/README_RU.md) | <sub>ES</sub> [Español](es/README_ES.md) | <sub>FR</sub> [Français](fr/README_FR.md) | <sub>TR</sub> [Türkçe](tr/README_TR.md) | <sub>ZH</sub> [中文](zh/README_ZH_CN.md) |
|
|
14
14
|
|-------------------------|----------------------------|----------------------------|----------------------------|----------------------------|----------------------------|
|
|
15
15
|
|
|
16
16
|
使用强大、稳定、高级的JavaScript [API](../api.md) 来开发Minecraft机器人,同时支持 Python。
|
|
17
17
|
|
|
18
|
-
第一次使用 node.js ?你可以先看看 [使用教程](../tutorial.md) 。了解过 Python?这里有一些 [Python实例](https://github.com/PrismarineJS/mineflayer/tree/master/examples/python)
|
|
18
|
+
第一次使用 node.js ?你可以先看看 [使用教程](../tutorial.md) 。了解过 Python?这里有一些 [Python实例](https://github.com/PrismarineJS/mineflayer/tree/master/examples/python),同时你也可以 [在谷歌Colab中运行Mineflayer](https://colab.research.google.com/github/PrismarineJS/mineflayer/blob/master/docs/mineflayer.ipynb) 来体验一下。
|
|
19
19
|
|
|
20
20
|
## 特点
|
|
21
21
|
|
|
22
|
-
* 支持版本:Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15 1.16 1.17
|
|
23
|
-
* 实体感知与追踪
|
|
24
|
-
* 方块感知,你可以在几毫秒内查找到bot周围的任何方块
|
|
25
|
-
* 物理和运动引擎 - 支持所有的碰撞箱
|
|
26
|
-
*
|
|
27
|
-
* 背包管理
|
|
28
|
-
* 使用工作台、箱子、酿造台、附魔台
|
|
29
|
-
* 挖掘和建造
|
|
30
|
-
*
|
|
31
|
-
* 激活方块和使用物品
|
|
32
|
-
*
|
|
33
|
-
|
|
22
|
+
* 支持版本:Minecraft 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15 1.16 1.17,1.18
|
|
23
|
+
* 实体感知与追踪
|
|
24
|
+
* 方块感知,你可以在几毫秒内查找到bot周围的任何方块
|
|
25
|
+
* 物理和运动引擎 - 支持所有的碰撞箱
|
|
26
|
+
* 攻击实体,使用交通工具
|
|
27
|
+
* 背包管理
|
|
28
|
+
* 使用工作台、箱子、酿造台、附魔台
|
|
29
|
+
* 挖掘和建造
|
|
30
|
+
* 各种各样的的信息接口,比如查看你的血量或是否下雨
|
|
31
|
+
* 激活方块和使用物品
|
|
32
|
+
* 进行聊天
|
|
34
33
|
### 路线图
|
|
35
34
|
|
|
36
35
|
[点这里](https://github.com/PrismarineJS/mineflayer/wiki/Big-Prismarine-projects) 看看目前我们有哪些实用的项目
|
|
@@ -178,7 +177,7 @@ node your_script.js
|
|
|
178
177
|
|
|
179
178
|
## 第三方插件
|
|
180
179
|
|
|
181
|
-
Mineflayer
|
|
180
|
+
Mineflayer 支持插件;任何人都可以创建一个插件,在 Mineflayer 之上添加更高级别的 API。
|
|
182
181
|
|
|
183
182
|
最新和最有用的有:
|
|
184
183
|
|
|
@@ -191,8 +190,12 @@ Mineflayer 是可插拔的;任何人都可以创建一个插件,在 Mineflay
|
|
|
191
190
|
* [Dashboard](https://github.com/wvffle/mineflayer-dashboard) - mineflayer bot 的前端仪表板
|
|
192
191
|
* [PVP](https://github.com/TheDudeFromCI/mineflayer-pvp) - 用于基本 PVP 和 PVE 的简单 API
|
|
193
192
|
* [auto-eat](https://github.com/LINKdiscordd/mineflayer-auto-eat) - 自动进食
|
|
194
|
-
* [
|
|
195
|
-
* [
|
|
193
|
+
* [Auto Crystal](https://github.com/link-discord/mineflayer-autocrystal) - 自动放置和破碎结
|
|
194
|
+
* [Tool](https://github.com/TheDudeFromCI/mineflayer-tool) - 一个具有高级API的工具/武器自动选择工具的工具
|
|
195
|
+
* [Hawkeye](https://github.com/sefirosweb/minecraftHawkEye) - 一个使用自动瞄准弓的工具
|
|
196
|
+
* [GUI](https://github.com/firejoust/mineflayer-GUI) - 简化了嵌套箱子GUI窗口的导航和管理
|
|
197
|
+
* [Projectile](https://github.com/firejoust/mineflayer-projectile) - 以投射物为基础的战斗的可配置插件
|
|
198
|
+
|
|
196
199
|
|
|
197
200
|
也可以看看这些 :
|
|
198
201
|
|
|
@@ -203,13 +206,14 @@ Mineflayer 是可插拔的;任何人都可以创建一个插件,在 Mineflay
|
|
|
203
206
|
* [Bloodhound](https://github.com/Nixes/mineflayer-bloodhound) - 确定谁和什么对另一个实体的损害负责
|
|
204
207
|
* [tps](https://github.com/SiebeDW/mineflayer-tps) - 获取当前的 tps(已处理的 tps)
|
|
205
208
|
* [panorama](https://github.com/IceTank/mineflayer-panorama) - 拍摄您的世界的全景图像
|
|
209
|
+
* [player-death-event](https://github.com/tuanzisama/mineflayer-death-event) - 在Mineflayer里监听玩家死亡事件
|
|
206
210
|
|
|
207
211
|
## 正在使用 Mineflayer 的项目
|
|
208
212
|
|
|
209
213
|
* [rom1504/rbot](https://github.com/rom1504/rbot)
|
|
210
|
-
* [YouTube -
|
|
211
|
-
* [YouTube -
|
|
212
|
-
* [Darthfett/Helperbot](https://github.com/Darthfett/Helperbot)
|
|
214
|
+
* [YouTube - 建造旋转楼梯](https://www.youtube.com/watch?v=UM1ZV5200S0)
|
|
215
|
+
* [YouTube - 复制一个建筑](https://www.youtube.com/watch?v=0cQxg9uDnzA)
|
|
216
|
+
* [Darthfett/Helperbot](https://github.com/Darthfett/Helperbot) - 完成一些简单指令
|
|
213
217
|
* [vogonistic/voxel](https://github.com/vogonistic/mineflayer-voxel) - 使用 voxel.js 可视化机器人正在做什么
|
|
214
218
|
* [JonnyD/Skynet](https://github.com/JonnyD/Skynet) - 将玩家活动记录到在线 API 上
|
|
215
219
|
* [MinecraftChat](https://github.com/rom1504/MinecraftChat) (最后一个开源版本,由 AlexKvazos 构建)——基于 Minecraft 网络的聊天客户端 <https://minecraftchat.net/>
|
|
@@ -233,6 +237,9 @@ Mineflayer 是可插拔的;任何人都可以创建一个插件,在 Mineflay
|
|
|
233
237
|
|
|
234
238
|
运行 `npm mocha_test -- -g <test_name>`,其中 `<test_name>` 是测试名称,例如 `bed`, `useChests`, `rayTrace`...
|
|
235
239
|
|
|
240
|
+
### 示例
|
|
241
|
+
|
|
242
|
+
`npm run mocha_test -- -g "1.18.1.*BlockFinder"` 进行1.18.1寻路测试
|
|
236
243
|
## 许可证
|
|
237
244
|
|
|
238
245
|
[MIT](../LICENSE)
|
package/examples/anvil.js
CHANGED
|
@@ -63,24 +63,22 @@ bot.on('chat', async (username, message) => {
|
|
|
63
63
|
}
|
|
64
64
|
})
|
|
65
65
|
|
|
66
|
-
function tossItem (name, amount) {
|
|
66
|
+
async function tossItem (name, amount) {
|
|
67
67
|
amount = parseInt(amount, 10)
|
|
68
68
|
const item = itemByName(name)
|
|
69
69
|
if (!item) {
|
|
70
70
|
bot.chat(`I have no ${name}`)
|
|
71
|
-
} else if (amount) {
|
|
72
|
-
bot.toss(item.type, null, amount, checkIfTossed)
|
|
73
71
|
} else {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
try {
|
|
73
|
+
if (amount) {
|
|
74
|
+
await bot.toss(item.type, null, amount)
|
|
75
|
+
bot.chat(`tossed ${amount} x ${name}`)
|
|
76
|
+
} else {
|
|
77
|
+
await bot.tossStack(item)
|
|
78
|
+
bot.chat(`tossed ${name}`)
|
|
79
|
+
}
|
|
80
|
+
} catch (err) {
|
|
79
81
|
bot.chat(`unable to toss: ${err.message}`)
|
|
80
|
-
} else if (amount) {
|
|
81
|
-
bot.chat(`tossed ${amount} x ${name}`)
|
|
82
|
-
} else {
|
|
83
|
-
bot.chat(`tossed ${name}`)
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
}
|
package/examples/chest.js
CHANGED
|
@@ -220,38 +220,36 @@ async function watchFurnace () {
|
|
|
220
220
|
bot.removeListener('chat', onChat)
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function putInFurnace (where, name, amount) {
|
|
223
|
+
async function putInFurnace (where, name, amount) {
|
|
224
224
|
const item = itemByName(furnace.items(), name)
|
|
225
225
|
if (item) {
|
|
226
226
|
const fn = {
|
|
227
227
|
input: furnace.putInput,
|
|
228
228
|
fuel: furnace.putFuel
|
|
229
229
|
}[where]
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
})
|
|
230
|
+
try {
|
|
231
|
+
await fn.call(furnace, item.type, null, amount)
|
|
232
|
+
bot.chat(`put ${amount} ${item.name}`)
|
|
233
|
+
} catch (err) {
|
|
234
|
+
bot.chat(`unable to put ${amount} ${item.name}`)
|
|
235
|
+
}
|
|
237
236
|
} else {
|
|
238
237
|
bot.chat(`unknown item ${name}`)
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
|
|
242
|
-
function takeFromFurnace (what) {
|
|
241
|
+
async function takeFromFurnace (what) {
|
|
243
242
|
const fn = {
|
|
244
243
|
input: furnace.takeInput,
|
|
245
244
|
fuel: furnace.takeFuel,
|
|
246
245
|
output: furnace.takeOutput
|
|
247
246
|
}[what]
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
})
|
|
247
|
+
try {
|
|
248
|
+
const item = await fn.call(furnace)
|
|
249
|
+
bot.chat(`took ${item.name}`)
|
|
250
|
+
} catch (err) {
|
|
251
|
+
bot.chat('unable to take')
|
|
252
|
+
}
|
|
255
253
|
}
|
|
256
254
|
}
|
|
257
255
|
}
|
package/examples/digger.js
CHANGED
|
@@ -56,7 +56,7 @@ function sayItems (items = bot.inventory.items()) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function dig () {
|
|
59
|
+
async function dig () {
|
|
60
60
|
let target
|
|
61
61
|
if (bot.targetDigBlock) {
|
|
62
62
|
bot.chat(`already digging ${bot.targetDigBlock.name}`)
|
|
@@ -64,19 +64,16 @@ function dig () {
|
|
|
64
64
|
target = bot.blockAt(bot.entity.position.offset(0, -1, 0))
|
|
65
65
|
if (target && bot.canDigBlock(target)) {
|
|
66
66
|
bot.chat(`starting to dig ${target.name}`)
|
|
67
|
-
|
|
67
|
+
try {
|
|
68
|
+
await bot.dig(target)
|
|
69
|
+
bot.chat(`finished digging ${target.name}`)
|
|
70
|
+
} catch (err) {
|
|
71
|
+
console.log(err.stack)
|
|
72
|
+
}
|
|
68
73
|
} else {
|
|
69
74
|
bot.chat('cannot dig')
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
|
-
|
|
73
|
-
function onDiggingCompleted (err) {
|
|
74
|
-
if (err) {
|
|
75
|
-
console.log(err.stack)
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
bot.chat(`finished digging ${target.name}`)
|
|
79
|
-
}
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
function build () {
|
|
@@ -87,28 +84,26 @@ function build () {
|
|
|
87
84
|
|
|
88
85
|
let tryCount = 0
|
|
89
86
|
|
|
90
|
-
function placeIfHighEnough () {
|
|
87
|
+
async function placeIfHighEnough () {
|
|
91
88
|
if (bot.entity.position.y > jumpY) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
tryCount++
|
|
95
|
-
if (tryCount > 10) {
|
|
96
|
-
bot.chat(err.message)
|
|
97
|
-
bot.setControlState('jump', false)
|
|
98
|
-
bot.removeListener('move', placeIfHighEnough)
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
return
|
|
102
|
-
}
|
|
89
|
+
try {
|
|
90
|
+
await bot.placeBlock(referenceBlock, vec3(0, 1, 0))
|
|
103
91
|
bot.setControlState('jump', false)
|
|
104
92
|
bot.removeListener('move', placeIfHighEnough)
|
|
105
93
|
bot.chat('Placing a block was successful')
|
|
106
|
-
})
|
|
94
|
+
} catch (err) {
|
|
95
|
+
tryCount++
|
|
96
|
+
if (tryCount > 10) {
|
|
97
|
+
bot.chat(err.message)
|
|
98
|
+
bot.setControlState('jump', false)
|
|
99
|
+
bot.removeListener('move', placeIfHighEnough)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
107
102
|
}
|
|
108
103
|
}
|
|
109
104
|
}
|
|
110
105
|
|
|
111
|
-
function equipDirt () {
|
|
106
|
+
async function equipDirt () {
|
|
112
107
|
const mcData = require('minecraft-data')(bot.version)
|
|
113
108
|
let itemsByName
|
|
114
109
|
if (bot.supportFeature('itemsAreNotBlocks')) {
|
|
@@ -116,13 +111,12 @@ function equipDirt () {
|
|
|
116
111
|
} else if (bot.supportFeature('itemsAreAlsoBlocks')) {
|
|
117
112
|
itemsByName = 'blocksByName'
|
|
118
113
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})
|
|
114
|
+
try {
|
|
115
|
+
await bot.equip(mcData[itemsByName].dirt.id, 'hand')
|
|
116
|
+
bot.chat('equipped dirt')
|
|
117
|
+
} catch (err) {
|
|
118
|
+
bot.chat(`unable to equip dirt: ${err.message}`)
|
|
119
|
+
}
|
|
126
120
|
}
|
|
127
121
|
|
|
128
122
|
function itemToString (item) {
|
package/examples/inventory.js
CHANGED
|
@@ -77,24 +77,22 @@ function sayItems (items = null) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function tossItem (name, amount) {
|
|
80
|
+
async function tossItem (name, amount) {
|
|
81
81
|
amount = parseInt(amount, 10)
|
|
82
82
|
const item = itemByName(name)
|
|
83
83
|
if (!item) {
|
|
84
84
|
bot.chat(`I have no ${name}`)
|
|
85
|
-
} else if (amount) {
|
|
86
|
-
bot.toss(item.type, null, amount, checkIfTossed)
|
|
87
85
|
} else {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
try {
|
|
87
|
+
if (amount) {
|
|
88
|
+
await bot.toss(item.type, null, amount)
|
|
89
|
+
bot.chat(`tossed ${amount} x ${name}`)
|
|
90
|
+
} else {
|
|
91
|
+
await bot.tossStack(item)
|
|
92
|
+
bot.chat(`tossed ${name}`)
|
|
93
|
+
}
|
|
94
|
+
} catch (err) {
|
|
93
95
|
bot.chat(`unable to toss: ${err.message}`)
|
|
94
|
-
} else if (amount) {
|
|
95
|
-
bot.chat(`tossed ${amount} x ${name}`)
|
|
96
|
-
} else {
|
|
97
|
-
bot.chat(`tossed ${name}`)
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
}
|
package/index.d.ts
CHANGED
|
@@ -189,6 +189,7 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
189
189
|
heldItem: Item | null
|
|
190
190
|
currentWindow: Window | null
|
|
191
191
|
simpleClick: simpleClick
|
|
192
|
+
tablist: Tablist
|
|
192
193
|
|
|
193
194
|
connect: (options: BotOptions) => void
|
|
194
195
|
|
|
@@ -228,7 +229,6 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
228
229
|
|
|
229
230
|
tabComplete: (
|
|
230
231
|
str: string,
|
|
231
|
-
cb: (matches: string[]) => void,
|
|
232
232
|
assumeCommand?: boolean,
|
|
233
233
|
sendBlockInSight?: boolean
|
|
234
234
|
) => Promise<string[]>
|
|
@@ -247,11 +247,11 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
247
247
|
|
|
248
248
|
hasPlugin: (plugin: Plugin) => boolean
|
|
249
249
|
|
|
250
|
-
sleep: (bedBlock: Block
|
|
250
|
+
sleep: (bedBlock: Block) => Promise<void>
|
|
251
251
|
|
|
252
252
|
isABed: (bedBlock: Block) => void
|
|
253
253
|
|
|
254
|
-
wake: (
|
|
254
|
+
wake: () => Promise<void>
|
|
255
255
|
|
|
256
256
|
setControlState: (control: ControlState, state: boolean) => void
|
|
257
257
|
|
|
@@ -261,38 +261,34 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
261
261
|
|
|
262
262
|
getExplosionDamages: (targetEntity: Entity, position: Vec3, radius: number, rawDamages?: boolean) => number | null
|
|
263
263
|
|
|
264
|
-
lookAt: (point: Vec3, force?: boolean
|
|
264
|
+
lookAt: (point: Vec3, force?: boolean) => Promise<void>
|
|
265
265
|
|
|
266
266
|
look: (
|
|
267
267
|
yaw: number,
|
|
268
268
|
pitch: number,
|
|
269
|
-
force?: boolean
|
|
270
|
-
callback?: () => void
|
|
269
|
+
force?: boolean
|
|
271
270
|
) => Promise<void>
|
|
272
271
|
|
|
273
272
|
updateSign: (block: Block, text: string) => void
|
|
274
273
|
|
|
275
274
|
equip: (
|
|
276
275
|
item: Item | number,
|
|
277
|
-
destination: EquipmentDestination | null
|
|
278
|
-
callback?: (error?: Error) => void
|
|
276
|
+
destination: EquipmentDestination | null
|
|
279
277
|
) => Promise<void>
|
|
280
278
|
|
|
281
279
|
unequip: (
|
|
282
|
-
destination: EquipmentDestination | null
|
|
283
|
-
callback?: () => void
|
|
280
|
+
destination: EquipmentDestination | null
|
|
284
281
|
) => Promise<void>
|
|
285
282
|
|
|
286
|
-
tossStack: (item: Item
|
|
283
|
+
tossStack: (item: Item) => Promise<void>
|
|
287
284
|
|
|
288
285
|
toss: (
|
|
289
286
|
itemType: number,
|
|
290
287
|
metadata: number | null,
|
|
291
|
-
count: number | null
|
|
292
|
-
callback?: (err?: Error) => void
|
|
288
|
+
count: number | null
|
|
293
289
|
) => Promise<void>
|
|
294
290
|
|
|
295
|
-
dig: ((block: Block, forceLook?: boolean | 'ignore'
|
|
291
|
+
dig: ((block: Block, forceLook?: boolean | 'ignore') => Promise<void>) & ((block: Block, forceLook: boolean | 'ignore', digFace: 'auto' | Vec3 | 'raycast') => Promise<void>)
|
|
296
292
|
|
|
297
293
|
stopDigging: () => void
|
|
298
294
|
|
|
@@ -302,15 +298,15 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
302
298
|
|
|
303
299
|
placeEntity: (referenceBlock: Block, faceVector: Vec3) => Promise<Entity>
|
|
304
300
|
|
|
305
|
-
activateBlock: (block: Block
|
|
301
|
+
activateBlock: (block: Block) => Promise<void>
|
|
306
302
|
|
|
307
|
-
activateEntity: (block: Entity
|
|
303
|
+
activateEntity: (block: Entity) => Promise<void>
|
|
308
304
|
|
|
309
|
-
activateEntityAt: (block: Entity, position: Vec3
|
|
305
|
+
activateEntityAt: (block: Entity, position: Vec3) => Promise<void>
|
|
310
306
|
|
|
311
|
-
consume: (
|
|
307
|
+
consume: () => Promise<void>
|
|
312
308
|
|
|
313
|
-
fish: (
|
|
309
|
+
fish: () => Promise<void>
|
|
314
310
|
|
|
315
311
|
activateItem: (offhand?: boolean) => void
|
|
316
312
|
|
|
@@ -333,14 +329,12 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
333
329
|
craft: (
|
|
334
330
|
recipe: Recipe,
|
|
335
331
|
count: number | null,
|
|
336
|
-
craftingTable: Block
|
|
337
|
-
callback?: () => void
|
|
332
|
+
craftingTable: Block
|
|
338
333
|
) => Promise<void>
|
|
339
334
|
|
|
340
335
|
writeBook: (
|
|
341
336
|
slot: number,
|
|
342
|
-
pages: string[]
|
|
343
|
-
callback?: (err?: Error) => void
|
|
337
|
+
pages: string[]
|
|
344
338
|
) => Promise<void>
|
|
345
339
|
|
|
346
340
|
openContainer: (chest: Block | Entity) => Promise<Chest | Furnace | Dispenser>
|
|
@@ -362,8 +356,7 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
362
356
|
trade: (
|
|
363
357
|
villagerInstance: Villager,
|
|
364
358
|
tradeIndex: string | number,
|
|
365
|
-
times?: number
|
|
366
|
-
cb?: (err?: Error) => void
|
|
359
|
+
times?: number
|
|
367
360
|
) => Promise<void>
|
|
368
361
|
|
|
369
362
|
setCommandBlock: (pos: Vec3, command: string, trackOutput: boolean) => void
|
|
@@ -371,23 +364,21 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
371
364
|
clickWindow: (
|
|
372
365
|
slot: number,
|
|
373
366
|
mouseButton: number,
|
|
374
|
-
mode: number
|
|
375
|
-
cb?: (err?: Error) => void
|
|
367
|
+
mode: number
|
|
376
368
|
) => Promise<void>
|
|
377
369
|
|
|
378
370
|
putSelectedItemRange: (
|
|
379
371
|
start: number,
|
|
380
372
|
end: number,
|
|
381
373
|
window: Window,
|
|
382
|
-
slot: any
|
|
383
|
-
cb?: (err?: Error) => void
|
|
374
|
+
slot: any
|
|
384
375
|
) => Promise<void>
|
|
385
376
|
|
|
386
|
-
putAway: (slot: number
|
|
377
|
+
putAway: (slot: number) => Promise<void>
|
|
387
378
|
|
|
388
379
|
closeWindow: (window: Window) => void
|
|
389
380
|
|
|
390
|
-
transfer: (options: TransferOptions
|
|
381
|
+
transfer: (options: TransferOptions) => Promise<void>
|
|
391
382
|
|
|
392
383
|
openBlock: (block: Block, Class: new () => EventEmitter) => Promise<void>
|
|
393
384
|
|
|
@@ -395,15 +386,14 @@ export interface Bot extends TypedEmitter<BotEvents> {
|
|
|
395
386
|
|
|
396
387
|
moveSlotItem: (
|
|
397
388
|
sourceSlot: number,
|
|
398
|
-
destSlot: number
|
|
399
|
-
cb?: (err?: Error) => void
|
|
389
|
+
destSlot: number
|
|
400
390
|
) => Promise<void>
|
|
401
391
|
|
|
402
392
|
updateHeldItem: () => void
|
|
403
393
|
|
|
404
394
|
getEquipmentDestSlot: (destination: string) => number
|
|
405
395
|
|
|
406
|
-
waitForChunksToLoad: (
|
|
396
|
+
waitForChunksToLoad: () => Promise<void>
|
|
407
397
|
|
|
408
398
|
nearestEntity: (filter?: (entity: Entity) => boolean) => Entity | null
|
|
409
399
|
|
|
@@ -427,6 +417,11 @@ export interface simpleClick {
|
|
|
427
417
|
rightMouse: (slot: number) => Promise<void>
|
|
428
418
|
}
|
|
429
419
|
|
|
420
|
+
export interface Tablist {
|
|
421
|
+
header: ChatMessage
|
|
422
|
+
footer: ChatMessage
|
|
423
|
+
}
|
|
424
|
+
|
|
430
425
|
export interface chatPatternOptions {
|
|
431
426
|
repeat: boolean
|
|
432
427
|
parse: boolean
|
|
@@ -573,11 +568,10 @@ export interface TransferOptions {
|
|
|
573
568
|
export interface creativeMethods {
|
|
574
569
|
setInventorySlot: (
|
|
575
570
|
slot: number,
|
|
576
|
-
item: Item | null
|
|
577
|
-
callback?: (error?: Error) => void
|
|
571
|
+
item: Item | null
|
|
578
572
|
) => Promise<void>
|
|
579
573
|
|
|
580
|
-
flyTo: (destination: Vec3
|
|
574
|
+
flyTo: (destination: Vec3) => Promise<void>
|
|
581
575
|
|
|
582
576
|
startFlying: () => void
|
|
583
577
|
|
|
@@ -628,15 +622,13 @@ export class Chest extends (EventEmitter as new () => TypedEmitter<StorageEvents
|
|
|
628
622
|
deposit (
|
|
629
623
|
itemType: number,
|
|
630
624
|
metadata: number | null,
|
|
631
|
-
count: number | null
|
|
632
|
-
cb?: (err?: Error) => void
|
|
625
|
+
count: number | null
|
|
633
626
|
): Promise<void>;
|
|
634
627
|
|
|
635
628
|
withdraw (
|
|
636
629
|
itemType: number,
|
|
637
630
|
metadata: number | null,
|
|
638
|
-
count: number | null
|
|
639
|
-
cb?: (err?: Error) => void
|
|
631
|
+
count: number | null
|
|
640
632
|
): Promise<void>;
|
|
641
633
|
|
|
642
634
|
count (itemType: number, metadata: number | null): number;
|
|
@@ -652,24 +644,22 @@ export class Furnace extends (EventEmitter as new () => TypedEmitter<FurnaceEven
|
|
|
652
644
|
|
|
653
645
|
close (): void;
|
|
654
646
|
|
|
655
|
-
takeInput (
|
|
647
|
+
takeInput (): Promise<Item>;
|
|
656
648
|
|
|
657
|
-
takeFuel (
|
|
649
|
+
takeFuel (): Promise<Item>;
|
|
658
650
|
|
|
659
|
-
takeOutput (
|
|
651
|
+
takeOutput (): Promise<Item>;
|
|
660
652
|
|
|
661
653
|
putInput (
|
|
662
654
|
itemType: number,
|
|
663
655
|
metadata: number | null,
|
|
664
|
-
count: number
|
|
665
|
-
cb?: (err?: Error) => void
|
|
656
|
+
count: number
|
|
666
657
|
): Promise<void>;
|
|
667
658
|
|
|
668
659
|
putFuel (
|
|
669
660
|
itemType: number,
|
|
670
661
|
metadata: number | null,
|
|
671
|
-
count: number
|
|
672
|
-
cb?: (err?: Error) => void
|
|
662
|
+
count: number
|
|
673
663
|
): Promise<void>;
|
|
674
664
|
|
|
675
665
|
inputItem (): Item;
|
|
@@ -687,15 +677,13 @@ export class Dispenser extends (EventEmitter as new () => TypedEmitter<StorageEv
|
|
|
687
677
|
deposit (
|
|
688
678
|
itemType: number,
|
|
689
679
|
metadata: number | null,
|
|
690
|
-
count: number | null
|
|
691
|
-
cb?: (err?: Error) => void
|
|
680
|
+
count: number | null
|
|
692
681
|
): Promise<void>;
|
|
693
682
|
|
|
694
683
|
withdraw (
|
|
695
684
|
itemType: number,
|
|
696
685
|
metadata: number | null,
|
|
697
|
-
count: number | null
|
|
698
|
-
cb?: (err?: Error) => void
|
|
686
|
+
count: number | null
|
|
699
687
|
): Promise<void>;
|
|
700
688
|
|
|
701
689
|
count (itemType: number, metadata: number | null): number;
|
|
@@ -713,15 +701,14 @@ export class EnchantmentTable extends (EventEmitter as new () => TypedEmitter<Co
|
|
|
713
701
|
targetItem (): Item;
|
|
714
702
|
|
|
715
703
|
enchant (
|
|
716
|
-
choice: string | number
|
|
717
|
-
cb?: (err: Error | null, item: Item) => void
|
|
704
|
+
choice: string | number
|
|
718
705
|
): Promise<Item>;
|
|
719
706
|
|
|
720
|
-
takeTargetItem (
|
|
707
|
+
takeTargetItem (): Promise<Item>;
|
|
721
708
|
|
|
722
|
-
putTargetItem (item: Item
|
|
709
|
+
putTargetItem (item: Item): Promise<Item>;
|
|
723
710
|
|
|
724
|
-
putLapis (item: Item
|
|
711
|
+
putLapis (item: Item): Promise<Item>;
|
|
725
712
|
}
|
|
726
713
|
|
|
727
714
|
export class Anvil {
|
|
@@ -796,7 +783,7 @@ export class Team {
|
|
|
796
783
|
|
|
797
784
|
update (name: string, friendlyFire: boolean, nameTagVisibility: string, collisionRule: string, formatting: number, prefix: string, suffix: string): void;
|
|
798
785
|
|
|
799
|
-
displayName (member: string);
|
|
786
|
+
displayName (member: string): ChatMessage;
|
|
800
787
|
}
|
|
801
788
|
|
|
802
789
|
export type DisplaySlot =
|