minecraft-data 2.114.1 → 2.116.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.
@@ -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
@@ -1102,7 +1102,7 @@ module.exports =
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") },
1104
1104
  get entityLoot () { return require("./minecraft-data/data/pc/1.18/entityLoot.json") },
1105
- get loginPacket () { return require("./minecraft-data/data/pc/1.18/loginPacket.json") },
1105
+ get loginPacket () { return require("./minecraft-data/data/pc/1.18.2/loginPacket.json") },
1106
1106
  get tints () { return require("./minecraft-data/data/pc/1.17/tints.json") },
1107
1107
  get mapIcons () { return require("./minecraft-data/data/pc/1.16/mapIcons.json") }
1108
1108
  }
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.116.0
2
+ * update mcdata
3
+
4
+ ## 2.115.2
5
+ * Add supportFeature support
6
+
7
+ ## 2.115.1
8
+ * update mcdata
9
+
1
10
  ## 2.114.1
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
 
@@ -1101,7 +1101,7 @@
1101
1101
  "particles": "pc/1.18",
1102
1102
  "blockLoot": "pc/1.18",
1103
1103
  "entityLoot": "pc/1.18",
1104
- "loginPacket": "pc/1.18",
1104
+ "loginPacket": "pc/1.18.2",
1105
1105
  "tints": "pc/1.17",
1106
1106
  "mapIcons": "pc/1.16"
1107
1107
  }