minecraft-data 2.114.0 → 2.115.2

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.
@@ -25,3 +25,8 @@ jobs:
25
25
  node-version: ${{ matrix.node-version }}
26
26
  - run: npm install
27
27
  - run: npm test
28
+ - name: Upload index.d.ts
29
+ if: always()
30
+ uses: actions/upload-artifact@v3.0.0
31
+ with:
32
+ path: index.d.ts
package/data.js CHANGED
@@ -1097,7 +1097,7 @@ module.exports =
1097
1097
  get entities () { return require("./minecraft-data/data/pc/1.18/entities.json") },
1098
1098
  get protocol () { return require("./minecraft-data/data/pc/1.18.2/protocol.json") },
1099
1099
  get windows () { return require("./minecraft-data/data/pc/1.16.1/windows.json") },
1100
- get version () { return require("./minecraft-data/data/pc/1.18.1/version.json") },
1100
+ get version () { return require("./minecraft-data/data/pc/1.18.2/version.json") },
1101
1101
  get foods () { return require("./minecraft-data/data/pc/1.17/foods.json") },
1102
1102
  get particles () { return require("./minecraft-data/data/pc/1.18/particles.json") },
1103
1103
  get blockLoot () { return require("./minecraft-data/data/pc/1.18/blockLoot.json") },
package/doc/api.md CHANGED
@@ -337,6 +337,10 @@ Mapping from 1.12 block:metadata to 1.13 block names
337
337
 
338
338
  examples 0:0 -> minecraft:air
339
339
 
340
+ ### minecraft-data.supportFeature(featureName) : Boolean
341
+
342
+ This can be used to check is a specific feature is available in the current Minecraft version. This is usually only required for handling version-specific functionality.
343
+
340
344
  ## Schemas
341
345
 
342
346
  ### minecraft-data.schemas.biomes
package/doc/history.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 2.115.2
2
+ * Add supportFeature support
3
+
4
+ ## 2.115.1
5
+ * update mcdata
6
+
7
+ ## 2.114.1
8
+ * update mcdata
9
+
1
10
  ## 2.114.0
2
11
  * update mcdata
3
12
 
package/index.d.ts CHANGED
@@ -443,6 +443,26 @@ declare namespace MinecraftData {
443
443
  }
444
444
 
445
445
 
446
+ type VersionForFeatureIdentification = string;
447
+ type Features = FeatureEntry[];
448
+
449
+ interface FeatureEntry {
450
+ /**
451
+ * The name of the feature
452
+ */
453
+ name?: string;
454
+ /**
455
+ * The description of the feature
456
+ */
457
+ description?: string;
458
+ /**
459
+ * A tuple that describes the range of versions in the range
460
+ */
461
+ versions?: VersionForFeatureIdentification[];
462
+ [k: string]: unknown;
463
+ }
464
+
465
+
446
466
  type Foods = Food[];
447
467
 
448
468
  interface Food {
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const mcDataToNode = require('./lib/loader')
2
+ const supportFeature = require('./lib/supportsFeature')
2
3
  const indexer = require('./lib/indexer.js')
3
4
  const protocolVersions = {
4
5
  pc: require('./minecraft-data/data/pc/common/protocolVersions.json'),
@@ -63,7 +64,7 @@ module.exports = function (mcVersion, preNetty) {
63
64
  nmcData.isOlderThan = version => nmcData.version['<'](version)
64
65
  nmcData.version = Object.assign(majorVersion, nmcData.version)
65
66
  cache[majorVersion.type + '_' + majorVersion.majorVersion] = nmcData
66
-
67
+ nmcData.supportFeature = feature => supportFeature(feature, nmcData.version.minecraftVersion)
67
68
  return nmcData
68
69
  }
69
70
 
@@ -0,0 +1,31 @@
1
+ const features = require('../minecraft-data/data/pc/common/features.json')
2
+
3
+ const versions = {
4
+ pc: require('../minecraft-data/data/pc/common/protocolVersions.json'),
5
+ bedrock: require('../minecraft-data/data/bedrock/common/protocolVersions.json')
6
+ }
7
+ const versionList = versions.pc
8
+ const versionToIndex = Object.fromEntries(versionList.map((version, i) => [version.minecraftVersion, versionList.length - i]))
9
+ const nameToFeature = Object.fromEntries(features.map(feature => [feature.name, feature]))
10
+
11
+ module.exports = (featureName, minecraftVersion) => {
12
+ const feature = nameToFeature[featureName]
13
+ if (feature === undefined) {
14
+ throw new Error(`Feature ${feature} doesn't exist`)
15
+ }
16
+
17
+ const currentVer = versionToIndex[minecraftVersion]
18
+ const minVer = versionToIndex[feature.versions[0]]
19
+ const maxVer = versionToIndex[feature.versions[1]]
20
+ if (currentVer === undefined) {
21
+ throw new Error(`Version ${minecraftVersion} doesn't exist`)
22
+ }
23
+ if (minVer === undefined) {
24
+ throw new Error(`Version ${feature.versions[0]} doesn't exist`)
25
+ }
26
+ if (maxVer === undefined) {
27
+ throw new Error(`Version ${feature.versions[1]} doesn't exist`)
28
+ }
29
+
30
+ return minVer <= currentVer && currentVer <= maxVer
31
+ }
@@ -0,0 +1,4 @@
1
+ ---
2
+ name: Blank Issue
3
+ about: Open a new issue
4
+ ---
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: New Version
3
+ about: Add a new minecraft version to MCD
4
+ title: 'Add version: '
5
+ ---
6
+
7
+ - [ ] Version folder containing "version.json" created
8
+ - [ ] "version.json" filled out appropriately
9
+ - [ ] Added version to dataPath.json
10
+ - [ ] "version" field of dataPath.json points to new version folder
11
+ - [ ] Version added to common/versions.json
12
+ - [ ] Version added to ReadMe
13
+
14
+ Additional Requirements For This Update:
@@ -55,6 +55,7 @@ Data provided:
55
55
  | Commands | a tree structure for vanilla minecraft server commands, and some info needed to implement sub-parsers.
56
56
  | Legacy | mappings between legacy (1.12) and post-flattening (1.13+) blocks and items ids
57
57
  | Skin data | (bedrock edition) Skin geometry and texture data for steve skin
58
+ | Features | This can be used to check is a specific feature is available in the current Minecraft version. This is usually only required for handling version-specific functionality.
58
59
 
59
60
  See more information about this data in the [documentation](http://prismarinejs.github.io/minecraft-data/)
60
61
 
@@ -1096,7 +1096,7 @@
1096
1096
  "entities": "pc/1.18",
1097
1097
  "protocol": "pc/1.18.2",
1098
1098
  "windows": "pc/1.16.1",
1099
- "version": "pc/1.18.1",
1099
+ "version": "pc/1.18.2",
1100
1100
  "foods": "pc/1.17",
1101
1101
  "particles": "pc/1.18",
1102
1102
  "blockLoot": "pc/1.18",
@@ -0,0 +1,337 @@
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": "the position is sent every tick",
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 y defaults to 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,3 +1,12 @@
1
+ ## 2.115.1
2
+ * Fix name conflict with existing "version" and type from features.json
3
+
4
+ ## 2.115.0
5
+ * Add features.json from mineflayer
6
+
7
+ ## 2.114.1
8
+ * fix 1.18.2 data paths
9
+
1
10
  ## 2.114.0
2
11
  * mcpc 1.18.2 protocol support
3
12
 
@@ -0,0 +1,32 @@
1
+ {
2
+ "title": "features",
3
+ "type": "array",
4
+ "uniqueItems": true,
5
+ "items": {
6
+ "title": "featureEntry",
7
+ "type": "object",
8
+ "properties": {
9
+ "name": {
10
+ "description": "The name of the feature",
11
+ "type": "string",
12
+ "pattern": ".+"
13
+ },
14
+ "description": {
15
+ "description": "The description of the feature",
16
+ "type": "string",
17
+ "pattern": ".+"
18
+ },
19
+ "versions": {
20
+ "description": "A tuple that describes the range of versions in the range",
21
+ "type": "array",
22
+ "uniqueItems": true,
23
+ "items": {
24
+ "title": "versionForFeatureIdentification",
25
+ "type": "string",
26
+ "minItems": 2,
27
+ "additionalItems": false
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
@@ -41,7 +41,7 @@ require('./version_iterator')(function (p, versionString) {
41
41
  })
42
42
  })
43
43
 
44
- const commonData = ['protocolVersions']
44
+ const commonData = ['protocolVersions', 'features']
45
45
  const minecraftTypes = ['pc', 'bedrock']
46
46
 
47
47
  minecraftTypes.forEach(function (type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-data",
3
- "version": "2.114.0",
3
+ "version": "2.115.2",
4
4
  "description": "Provide easy access to minecraft data in node.js",
5
5
  "main": "index.js",
6
6
  "tonicExampleFilename": "example.js",