mineflayer 4.1.0 → 4.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mineflayer",
3
- "version": "4.1.0",
3
+ "version": "4.4.0",
4
4
  "description": "create minecraft bots with a stable, high level API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -8,8 +8,8 @@
8
8
  "mocha_test": "mocha --reporter spec --exit",
9
9
  "test": "npm run mocha_test",
10
10
  "pretest": "npm run lint",
11
- "lint": "standard && ts-standard *.d.ts && standard-markdown",
12
- "fix": "standard --fix && ts-standard --fix *.d.ts && standard-markdown --fix",
11
+ "lint": "standard && standard-markdown",
12
+ "fix": "standard --fix && standard-markdown --fix",
13
13
  "prepublishOnly": "cp docs/README.md README.md"
14
14
  },
15
15
  "repository": {
@@ -21,17 +21,18 @@
21
21
  },
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "minecraft-data": "^2.114.1",
24
+ "minecraft-data": "^3.0.0",
25
25
  "minecraft-protocol": "^1.31.0",
26
26
  "prismarine-biome": "^1.1.1",
27
27
  "prismarine-block": "^1.13.1",
28
28
  "prismarine-chat": "^1.3.3",
29
29
  "prismarine-chunk": "^1.29.0",
30
30
  "prismarine-entity": "^2.0.0",
31
- "prismarine-item": "^1.11.0",
31
+ "prismarine-item": "^1.11.5",
32
32
  "prismarine-nbt": "^2.0.0",
33
33
  "prismarine-physics": "^1.3.1",
34
34
  "prismarine-recipe": "^1.1.0",
35
+ "prismarine-registry": "^1.0.0",
35
36
  "prismarine-windows": "^2.4.2",
36
37
  "prismarine-world": "^3.6.0",
37
38
  "protodef": "^1.14.0",
@@ -39,14 +40,13 @@
39
40
  "vec3": "^0.1.7"
40
41
  },
41
42
  "devDependencies": {
42
- "@types/node": "^17.0.0",
43
+ "@types/node": "^18.0.6",
43
44
  "doctoc": "^2.0.1",
44
45
  "minecraft-wrap": "^1.3.0",
45
46
  "mineflayer": "file:.",
46
- "mocha": "^9.1.2",
47
- "standard": "^16.0.4",
47
+ "mocha": "^10.0.0",
48
+ "standard": "^17.0.0",
48
49
  "standard-markdown": "^7.1.0",
49
- "ts-standard": "^11.0.0",
50
50
  "typescript": "^4.4.3"
51
51
  }
52
52
  }
package/lib/features.json DELETED
@@ -1,337 +0,0 @@
1
- [
2
- {
3
- "name": "mobSpawner",
4
- "description": "spawner is called mob_spawner",
5
- "versions": ["1.8", "1.12.2"]
6
- },
7
- {
8
- "name": "spawner",
9
- "description": "spawner is called spawner",
10
- "versions": ["1.13", "1.18.2"]
11
- },
12
- {
13
- "name": "blockMetadata",
14
- "description": "block metadata is encoded in a separate metadata",
15
- "versions": ["1.8", "1.12.2"]
16
- },
17
- {
18
- "name": "blockStateId",
19
- "description": "block metadata is encoded as state id",
20
- "versions": ["1.13", "1.18.2"]
21
- },
22
- {
23
- "name": "creativeSleepNearMobs",
24
- "description": "can sleep near mobs in creative",
25
- "versions": ["1.13", "1.18.2"]
26
- },
27
- {
28
- "name": "fixedPointPosition",
29
- "description": "Entity positions are represented with fixed point numbers",
30
- "versions": ["1.8", "1.8.9"]
31
- },
32
- {
33
- "name": "doublePosition",
34
- "description": "Entity positions are represented with double",
35
- "versions": ["1.9", "1.18.2"]
36
- },
37
- {
38
- "name": "fixedPointDelta",
39
- "description": "Delta of position are represented with fixed point numbers",
40
- "versions": ["1.8", "1.8.9"]
41
- },
42
- {
43
- "name": "fixedPointDelta128",
44
- "description": "Delta of position are represented with fixed point numbers times 128",
45
- "versions": ["1.9", "1.18.2"]
46
- },
47
- {
48
- "name": "customChannelMCPrefixed",
49
- "description": "custom channel are prefixed by MC|",
50
- "versions": ["1.8", "1.12.2"]
51
- },
52
- {
53
- "name": "customChannelIdentifier",
54
- "description": "custom channel is an identifier starting in minecraft namespace",
55
- "versions": ["1.13", "1.18.2"]
56
- },
57
- {
58
- "name": "dimensionDataIsAvailable",
59
- "description": "dimensionData is available, providing an additional information about the current dimension",
60
- "versions": ["1.17", "1.18.2"]
61
- },
62
- {
63
- "name": "useItemWithBlockPlace",
64
- "description": "use item is done with block place packet",
65
- "versions": ["1.8", "1.8.9"]
66
- },
67
- {
68
- "name": "useItemWithOwnPacket",
69
- "description": "use item is done with its own packet",
70
- "versions": ["1.9", "1.18.2"]
71
- },
72
- {
73
- "name": "blockPlaceHasHeldItem",
74
- "description": "block_place packet has heldItem",
75
- "versions": ["1.8", "1.8.9"]
76
- },
77
- {
78
- "name": "blockPlaceHasHandAndIntCursor",
79
- "description": "block_place packet has hand and int cursor",
80
- "versions": ["1.9", "1.10.2"]
81
- },
82
- {
83
- "name": "blockPlaceHasHandAndFloatCursor",
84
- "description": "block_place packet has hand and float cursor",
85
- "versions": ["1.11", "1.13.2"]
86
- },
87
- {
88
- "name": "blockPlaceHasInsideBlock",
89
- "description": "block_place packet has inside block",
90
- "versions": ["1.14", "1.18.2"]
91
- },
92
- {
93
- "name": "teleportUsesPositionPacket",
94
- "description": "teleport is done using position packet",
95
- "versions": ["1.8", "1.8.9"]
96
- },
97
- {
98
- "name": "positionUpdateSentEveryTick",
99
- "description": "",
100
- "versions": ["1.8", "1.11.2"]
101
- },
102
- {
103
- "name": "teleportUsesOwnPacket",
104
- "description": "teleport is done using its own packet",
105
- "versions": ["1.9", "1.18.2"]
106
- },
107
- {
108
- "name": "oneBlockForSeveralVariations",
109
- "description": "one block of several variations",
110
- "versions": ["1.8", "1.12.2"]
111
- },
112
- {
113
- "name": "blockSchemeIsFlat",
114
- "description": "all variations of a packet have their own id",
115
- "versions": ["1.13", "1.18.2"]
116
- },
117
- {
118
- "name": "tabCompleteHasNoToolTip",
119
- "description": "tab complete doesn't have a tool tip",
120
- "versions": ["1.8", "1.12.2"]
121
- },
122
- {
123
- "name": "tabCompleteHasAToolTip",
124
- "description": "tab complete has a tool tip",
125
- "versions": ["1.13", "1.18.2"]
126
- },
127
- {
128
- "name": "effectAreMinecraftPrefixed",
129
- "description": "effect are prefixed by minecraft:",
130
- "versions": ["1.8", "1.12.2"]
131
- },
132
- {
133
- "name": "effectAreNotPrefixed",
134
- "description": "effect are not prefixed",
135
- "versions": ["1.13", "1.18.2"]
136
- },
137
- {
138
- "name": "itemsAreAlsoBlocks",
139
- "description": "items are also blocks",
140
- "versions": ["1.8", "1.12.2"]
141
- },
142
- {
143
- "name": "itemsAreNotBlocks",
144
- "description": "items are not block",
145
- "versions": ["1.13", "1.18.2"]
146
- },
147
- {
148
- "name": "fishingBobberCorrectlyNamed",
149
- "description": "the fishing hook entity is named fishing_bobber",
150
- "versions": ["1.14", "1.18.2"]
151
- },
152
- {
153
- "name": "editBookIsPluginChannel",
154
- "description": "book editing is handled through plugin channels",
155
- "versions": ["1.8", "1.12.2"]
156
- },
157
- {
158
- "name": "hasEditBookPacket",
159
- "description": "book editing is handled through a packet",
160
- "versions": ["1.13", "1.18.2"]
161
- },
162
- {
163
- "name": "clientUpdateBookIdWhenSign",
164
- "description": "when sending MC|BSign, item type should be written_book",
165
- "versions": ["1.8", "1.8.9"]
166
- },
167
- {
168
- "name": "useMCTrSel",
169
- "description": "select trade through plugin channel MC|TrSel",
170
- "versions": ["1.8", "1.12.2"]
171
- },
172
- {
173
- "name": "useMCTrList",
174
- "description": "receive trade list through plugin channel MC|TrList",
175
- "versions": ["1.8", "1.12.2"]
176
- },
177
- {
178
- "name": "usetraderlist",
179
- "description": "receive trade list through plugin channel usetrader_list",
180
- "versions": ["1.13", "1.13.2"]
181
- },
182
- {
183
- "name": "doesntHaveOffHandSlot",
184
- "description": "doesn't have an off-hand slot",
185
- "versions": ["1.8", "1.8.9"]
186
- },
187
- {
188
- "name": "dimensionIsAnInt",
189
- "description": "description is an int (an enum)",
190
- "versions": ["1.8", "1.15.2"]
191
- },
192
- {
193
- "name": "dimensionIsAString",
194
- "description": "description is a string",
195
- "versions": ["1.16", "1.16.1"]
196
- },
197
- {
198
- "name": "dimensionIsAWorld",
199
- "description": "description is a world name (string)",
200
- "versions": ["1.16.2", "1.18.2"]
201
- },
202
- {
203
- "name": "dimensionDataIsAvailable",
204
- "description": "dimensionData is available, describing additional dimension information",
205
- "versions": ["1.17", "1.18.2"]
206
- },
207
- {
208
- "name": "doesntHaveChestType",
209
- "description": "chests don't have a type property",
210
- "versions": ["1.8", "1.12.2"]
211
- },
212
- {
213
- "name": "usesAdvCdm",
214
- "description": "packet MC|AdvCmd was incorrectly spelled in 1.8 as MC|AdvCdm",
215
- "versions": ["1.8", "1.8.9"]
216
- },
217
- {
218
- "name": "usesAdvCmd",
219
- "description": "uses MC|AdvCmd to set command block information",
220
- "versions": ["1.9", "1.12.2"]
221
- },
222
- {
223
- "name": "indexesVillagerRecipes",
224
- "description": "gives a index for each trade in a villagers metadata",
225
- "versions": ["1.8", "1.11.2"]
226
- },
227
- {
228
- "name": "hasAttackCooldown",
229
- "description": "if there is a cooldown after attacks to deal full damage",
230
- "versions": ["1.9", "1.18.2"]
231
- },
232
- {
233
- "name": "usesLoginPacket",
234
- "description": "uses the login packet as defined in mcData",
235
- "versions": ["1.16", "1.18.2"]
236
- },
237
- {
238
- "name": "usesMultiblockSingleLong",
239
- "description": "in the multi_block_change packet is stored as a single number",
240
- "versions": ["1.16.2", "1.18.2"]
241
- },
242
- {
243
- "name": "usesMultiblock3DChunkCoords",
244
- "description": "in the multi_block_change packet, all 3 axis coords are defined",
245
- "versions": ["1.16.2", "1.18.2"]
246
- },
247
- {
248
- "name": "setBlockUsesMetadataNumber",
249
- "description": "the parameter metadata of the setblock command is a number",
250
- "versions": ["1.8", "1.12.2"]
251
- },
252
- {
253
- "name": "useMCItemName",
254
- "description": "send item name for anvil using plugin channel MC|TrList",
255
- "versions": ["1.8", "1.12.2"]
256
- },
257
- {
258
- "name": "selectingTradeMovesItems",
259
- "description": "selecting a trade automatically puts the required items into trading slots",
260
- "versions": ["1.14", "1.18.2"]
261
- },
262
- {
263
- "name": "resourcePackUsesHash",
264
- "description": "resource pack uses hash validation",
265
- "versions": ["1.8", "1.9.4"]
266
- },
267
- {
268
- "name": "lessCharsInChat",
269
- "description": "max chars in chat",
270
- "versions": ["1.8", "1.10.2"]
271
- },
272
- {
273
- "name": "teamUsesChatComponents",
274
- "description": "teams use chatcomponents for formatting",
275
- "versions": ["1.13", "1.18.2"]
276
- },
277
- {
278
- "name": "teamUsesScoreboard",
279
- "description": "teams use scoreboard_team packet",
280
- "versions": ["1.8", "1.8.9"]
281
- },
282
- {
283
- "name": "enderCrystalNameEndsInErNoCaps",
284
- "description": "this is when the end_crystal's entity name is ender_crystal",
285
- "versions": ["1.11", "1.12.2"]
286
- },
287
- {
288
- "name": "enderCrystalNameNoCapsWithUnderscore",
289
- "description": "this is when the end_crystal's entity name is end_crystal",
290
- "versions": ["1.14", "1.18.2"]
291
- },
292
- {
293
- "name": "entityNameUpperCaseNoUnderscore",
294
- "description": "this is when some entities names would be captialized and appended without underscores like 'Boat' or 'ArmorStand'",
295
- "versions": ["1.8", "1.10.2"]
296
- },
297
- {
298
- "name": "entityNameLowerCaseNoUnderscore",
299
- "description": "this is when some entity names are lowercase and appended without underscores like 'armorstand' or 'endercrystal'",
300
- "versions": ["1.13", "1.13.2"]
301
- },
302
- {
303
- "name": "transactionPacketExists",
304
- "description": "this is when the description packet existed",
305
- "versions": ["1.8", "1.16.5"]
306
- },
307
- {
308
- "name": "stateIdUsed",
309
- "description": "starting in 1.17.1, actionId has been replaced with stateId",
310
- "versions": ["1.17.1", "1.18.2"]
311
- },
312
- {
313
- "name": "actionIdUsed",
314
- "description": "pre 1.17, actionId is used",
315
- "versions": ["1.8", "1.16.5"]
316
- },
317
- {
318
- "name": "setSlotAsTransaction",
319
- "description": "use setslot as transaction instead of just hoping it'll work",
320
- "versions": ["1.17", "1.18.2"]
321
- },
322
- {
323
- "name": "armAnimationBeforeUse",
324
- "description": "arm animation packet sent before use entity packet",
325
- "versions": ["1.8", "1.8.9"]
326
- },
327
- {
328
- "name": "tallWorld",
329
- "description": "world starts at -64 and ends at 384",
330
- "versions": ["1.18", "1.18.2"]
331
- },
332
- {
333
- "name": "sendStringifiedSignText",
334
- "description": "sign text send when updating signs is send as stringified strings",
335
- "versions": ["1.8", "1.8.9"]
336
- }
337
- ]
@@ -1,27 +0,0 @@
1
- const features = require('./features')
2
-
3
- const versionList = require('minecraft-data').versions.pc
4
- const versionToIndex = Object.fromEntries(versionList.map((version, i) => [version.minecraftVersion, versionList.length - i]))
5
- const nameToFeature = Object.fromEntries(features.map(feature => [feature.name, feature]))
6
-
7
- module.exports = (featureName, minecraftVersion) => {
8
- const feature = nameToFeature[featureName]
9
- if (feature === undefined) {
10
- throw new Error(`Feature ${feature} doesn't exist`)
11
- }
12
-
13
- const currentVer = versionToIndex[minecraftVersion]
14
- const minVer = versionToIndex[feature.versions[0]]
15
- const maxVer = versionToIndex[feature.versions[1]]
16
- if (currentVer === undefined) {
17
- throw new Error(`Version ${minecraftVersion} doesn't exist`)
18
- }
19
- if (minVer === undefined) {
20
- throw new Error(`Version ${feature.versions[0]} doesn't exist`)
21
- }
22
- if (maxVer === undefined) {
23
- throw new Error(`Version ${feature.versions[1]} doesn't exist`)
24
- }
25
-
26
- return minVer <= currentVer && currentVer <= maxVer
27
- }