minecraft-data 2.93.0 → 2.96.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.
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- node-version: [12.x, 14.x]
16
+ node-version: [14.x]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v2
package/data.js CHANGED
@@ -1012,11 +1012,13 @@ module.exports =
1012
1012
  },
1013
1013
  '1.16.201': {
1014
1014
  get protocol () { return require("./minecraft-data/data/bedrock/1.16.201/protocol.json") },
1015
+ get steve () { return require("./minecraft-data/data/bedrock/1.16.201/steve.json") },
1015
1016
  proto: __dirname + '/minecraft-data/data/bedrock/1.17.0/proto.yml',
1016
1017
  types: __dirname + '/minecraft-data/data/bedrock/1.17.0/types.yml'
1017
1018
  },
1018
1019
  '1.16.210': {
1019
1020
  get protocol () { return require("./minecraft-data/data/bedrock/1.16.210/protocol.json") },
1021
+ get steve () { return require("./minecraft-data/data/bedrock/1.16.201/steve.json") },
1020
1022
  proto: __dirname + '/minecraft-data/data/bedrock/1.17.0/proto.yml',
1021
1023
  types: __dirname + '/minecraft-data/data/bedrock/1.17.0/types.yml'
1022
1024
  },
@@ -1059,6 +1061,44 @@ module.exports =
1059
1061
  get steve () { return require("./minecraft-data/data/bedrock/1.16.201/steve.json") },
1060
1062
  get blocksB2J () { return require("./minecraft-data/data/bedrock/1.17.10/blocksB2J.json") },
1061
1063
  get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.17.10/blocksJ2B.json") },
1064
+ proto: __dirname + '/minecraft-data/data/bedrock/1.17.10/proto.yml',
1065
+ types: __dirname + '/minecraft-data/data/bedrock/1.17.10/types.yml'
1066
+ },
1067
+ '1.17.30': {
1068
+ get blocks () { return require("./minecraft-data/data/bedrock/1.17.10/blocks.json") },
1069
+ get blockStates () { return require("./minecraft-data/data/bedrock/1.17.10/blockStates.json") },
1070
+ get blockCollisionShapes () { return require("./minecraft-data/data/bedrock/1.17.10/blockCollisionShapes.json") },
1071
+ get biomes () { return require("./minecraft-data/data/bedrock/1.17.0/biomes.json") },
1072
+ get items () { return require("./minecraft-data/data/bedrock/1.17.10/items.json") },
1073
+ get recipes () { return require("./minecraft-data/data/bedrock/1.17.10/recipes.json") },
1074
+ get instruments () { return require("./minecraft-data/data/bedrock/1.17.0/instruments.json") },
1075
+ get materials () { return require("./minecraft-data/data/pc/1.17/materials.json") },
1076
+ get enchantments () { return require("./minecraft-data/data/pc/1.17/enchantments.json") },
1077
+ get effects () { return require("./minecraft-data/data/pc/1.17/effects.json") },
1078
+ get protocol () { return require("./minecraft-data/data/bedrock/1.17.30/protocol.json") },
1079
+ get windows () { return require("./minecraft-data/data/bedrock/1.16.201/windows.json") },
1080
+ get steve () { return require("./minecraft-data/data/bedrock/1.16.201/steve.json") },
1081
+ get blocksB2J () { return require("./minecraft-data/data/bedrock/1.17.10/blocksB2J.json") },
1082
+ get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.17.10/blocksJ2B.json") },
1083
+ proto: __dirname + '/minecraft-data/data/bedrock/1.17.30/proto.yml',
1084
+ types: __dirname + '/minecraft-data/data/bedrock/1.17.30/types.yml'
1085
+ },
1086
+ '1.17.40': {
1087
+ get blocks () { return require("./minecraft-data/data/bedrock/1.17.10/blocks.json") },
1088
+ get blockStates () { return require("./minecraft-data/data/bedrock/1.17.10/blockStates.json") },
1089
+ get blockCollisionShapes () { return require("./minecraft-data/data/bedrock/1.17.10/blockCollisionShapes.json") },
1090
+ get biomes () { return require("./minecraft-data/data/bedrock/1.17.0/biomes.json") },
1091
+ get items () { return require("./minecraft-data/data/bedrock/1.17.10/items.json") },
1092
+ get recipes () { return require("./minecraft-data/data/bedrock/1.17.10/recipes.json") },
1093
+ get instruments () { return require("./minecraft-data/data/bedrock/1.17.0/instruments.json") },
1094
+ get materials () { return require("./minecraft-data/data/pc/1.17/materials.json") },
1095
+ get enchantments () { return require("./minecraft-data/data/pc/1.17/enchantments.json") },
1096
+ get effects () { return require("./minecraft-data/data/pc/1.17/effects.json") },
1097
+ get protocol () { return require("./minecraft-data/data/bedrock/1.17.40/protocol.json") },
1098
+ get windows () { return require("./minecraft-data/data/bedrock/1.16.201/windows.json") },
1099
+ get steve () { return require("./minecraft-data/data/bedrock/1.16.201/steve.json") },
1100
+ get blocksB2J () { return require("./minecraft-data/data/bedrock/1.17.10/blocksB2J.json") },
1101
+ get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.17.10/blocksJ2B.json") },
1062
1102
  proto: __dirname + '/minecraft-data/data/bedrock/latest/proto.yml',
1063
1103
  types: __dirname + '/minecraft-data/data/bedrock/latest/types.yml'
1064
1104
  }
package/doc/api.md CHANGED
@@ -122,6 +122,10 @@ enchantments indexed by name
122
122
 
123
123
  unindexed enchantments
124
124
 
125
+ ### minecraft-data.defaultSkin
126
+
127
+ (bedrock edition) Skin geometry and texture data for default player skin
128
+
125
129
  ## Protocol
126
130
 
127
131
  ### minecraft-data.protocol
@@ -168,10 +172,36 @@ the version number (example : 47)
168
172
 
169
173
  the minecraft number (example : 1.8.3)
170
174
 
175
+ ### minecraft-data.version.type
176
+
177
+ the version type, currently 'pc' or 'bedrock'
178
+
171
179
  ### minecraft-data.version.majorVersion
172
180
 
173
181
  the major version (example : 1.8), also the name of the minecraft-data version
174
182
 
183
+ ### minecraft-data.version.< (other)
184
+ Returns true if the current version is less than than the `other` version's dataVersion
185
+
186
+ ### minecraft-data.version.> (other)
187
+ Returns true if the current version is greater than the `other` version's dataVersion
188
+
189
+ ### minecraft-data.version.== (other)
190
+ Returns true if the current version is equal to the `other` version's dataVersion
191
+
192
+ ### minecraft-data.version.>=, minecraft-data.version.<=
193
+
194
+ Same as above but also allows equal dataVersion. The other version must be of the same type, the prefix is always implied.
195
+
196
+ Example Usage:
197
+ ```js
198
+ const mcd = require('minecraft-data')('1.16.4')
199
+ console.log('1.16.4 >= 1.17 ?', mcd.version['>=']('1.17')) // False
200
+
201
+ const mcd = require('minecraft-data')('bedrock_1.17.0')
202
+ console.log('1.17.0 > 1.16.220 ?', mcd.version['>']('1.16.220')) // True
203
+ ```
204
+
175
205
  ## Effects
176
206
 
177
207
  ### minecraft-data.effects
package/doc/history.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 2.96.0
2
+ * update mcdata
3
+
4
+ ## 2.95.0
5
+ * update mcdata
6
+
7
+ ## 2.94.0
8
+ * update mcdata
9
+
10
+ ## 2.93.1
11
+ * Update bedrock item and version handling (@extremeheat)
12
+
1
13
  ## 2.93.0
2
14
  * update mcdata
3
15
 
package/index.d.ts CHANGED
@@ -799,7 +799,21 @@ declare namespace MinecraftData {
799
799
  id: number;
800
800
  }[];
801
801
  }
802
-
802
+ // This will interface will merge with the generated one
803
+ export interface Version {
804
+ // Returns true if the current version is greater than or equal to the `other` version's dataVersion
805
+ ['>='](other)
806
+ // Returns true if the current version is greater than the `other` version's dataVersion
807
+ ['>'](other)
808
+ // Returns true if the current version is less than the `other` version's dataVersion
809
+ ['<'](other)
810
+ // Returns true if the current version is less than than or equal to the `other` version's dataVersion
811
+ ['<='](other)
812
+ // Returns true if the current version is equal to the `other` version's dataVersion
813
+ ['=='](other)
814
+ type: 'pc' | 'bedrock'
815
+ }
816
+
803
817
  export interface VersionSet {
804
818
  pc: { [version: string]: Version };
805
819
  bedrock: { [version: string]: Version };
package/index.js CHANGED
@@ -13,7 +13,8 @@ const types = ['pc', 'bedrock']
13
13
  types.forEach(function (type) {
14
14
  for (let i = 0; i < protocolVersions[type].length; i++) {
15
15
  if (!protocolVersions[type][i].dataVersion) {
16
- protocolVersions[type][i].dataVersion = -i
16
+ // We start top to bottom, so the ones at the bottom should be greater
17
+ protocolVersions[type][i].dataVersion = -protocolVersions[type].length + i
17
18
  }
18
19
  }
19
20
  versionsByMinecraftVersion[type] = indexer.buildIndexFromArray(protocolVersions[type], 'minecraftVersion')
@@ -22,10 +23,32 @@ types.forEach(function (type) {
22
23
  postNettyVersionsByProtocolVersion[type] = indexer.buildIndexFromArrayNonUnique(protocolVersions[type].filter(function (e) { return e.usesNetty }), 'version')
23
24
  })
24
25
 
26
+ function Version (type, version, majorVersion) {
27
+ const versions = versionsByMinecraftVersion[type]
28
+ // Allows comparisons against majorVersion even if `other` is not present in the versions.json (e.g. 1.17.0 exists but not 1.17)
29
+ for (const version in versions) {
30
+ const ver = versions[version]
31
+ versions[ver.majorVersion] = versions[ver.majorVersion] || ver
32
+ }
33
+ // TODO: Data for Minecraft classic is missing in protocolVersions.json, move this to its own type ?
34
+ const v1 = versions[version]?.dataVersion ?? 0
35
+ const raise = other => { throw new RangeError(`Version '${other}' not found in [${Object.keys(versions).join(' ; ')}] for ${type}`) }
36
+ this['>='] = other => versions[other] ? v1 >= versions[other].dataVersion : raise(other)
37
+ this['>'] = other => versions[other] ? v1 > versions[other].dataVersion : raise(other)
38
+ this['<'] = other => versions[other] ? v1 < versions[other].dataVersion : raise(other)
39
+ this['<='] = other => versions[other] ? v1 <= versions[other].dataVersion : raise(other)
40
+ this['=='] = other => versions[other] ? v1 === versions[other].dataVersion : raise(other)
41
+ this.type = type
42
+ this.majorVersion = majorVersion
43
+ return this
44
+ }
45
+
25
46
  const cache = {} // prevent reindexing when requiring multiple time the same version
26
47
 
27
48
  module.exports = function (mcVersion, preNetty) {
28
49
  preNetty = preNetty || false
50
+ mcVersion = String(mcVersion).replace('pe_', 'bedrock_')
51
+
29
52
  const majorVersion = toMajor(mcVersion, preNetty)
30
53
  if (majorVersion == null) { return null }
31
54
  if (cache[majorVersion.type + '_' + majorVersion.majorVersion]) { return cache[majorVersion.type + '_' + majorVersion.majorVersion] }
@@ -33,20 +56,16 @@ module.exports = function (mcVersion, preNetty) {
33
56
  if (mcData == null) { return null }
34
57
  const nmcData = mcDataToNode(mcData)
35
58
  nmcData.type = majorVersion.type
36
- nmcData.isNewerOrEqualTo = function (version) {
37
- const v1 = versionsByMinecraftVersion[this.type][this.version.minecraftVersion].dataVersion
38
- const v2 = versionsByMinecraftVersion[this.type][version].dataVersion
39
- return v1 >= v2
40
- }
41
- nmcData.isOlderThan = function (version) {
42
- const v1 = versionsByMinecraftVersion[this.type][this.version.minecraftVersion].dataVersion
43
- const v2 = versionsByMinecraftVersion[this.type][version].dataVersion
44
- return v1 < v2
45
- }
59
+ nmcData.isNewerOrEqualTo = version => nmcData.version['>='](version)
60
+ nmcData.isOlderThan = version => nmcData.version['<'](version)
61
+ nmcData.version = Object.assign(majorVersion, nmcData.version)
46
62
  cache[majorVersion.type + '_' + majorVersion.majorVersion] = nmcData
63
+
47
64
  return nmcData
48
65
  }
49
66
 
67
+ module.exports.Version = Version
68
+
50
69
  // adapt the version, most often doesn't convert to major version, can even convert to minor version when possible
51
70
  function toMajor (mcVersion, preNetty, typeArg) {
52
71
  const parts = (mcVersion + '').split('_')
@@ -68,10 +87,7 @@ function toMajor (mcVersion, preNetty, typeArg) {
68
87
  } else if (versionsByMajorVersion[type][version]) {
69
88
  majorVersion = versionsByMajorVersion[type][version].minecraftVersion
70
89
  }
71
- return {
72
- majorVersion: majorVersion,
73
- type: type
74
- }
90
+ return new Version(type, version, majorVersion)
75
91
  }
76
92
 
77
93
  module.exports.supportedVersions = {
package/lib/loader.js CHANGED
@@ -8,6 +8,8 @@ function mcDataToNode (mcData) {
8
8
  blocksArray: mcData.blocks,
9
9
  blocksByStateId: indexes.blocksByStateId,
10
10
 
11
+ blockStates: mcData.blockStates, // bedrock
12
+
11
13
  blockCollisionShapes: mcData.blockCollisionShapes,
12
14
 
13
15
  biomes: indexes.biomesById,
@@ -46,6 +48,9 @@ function mcDataToNode (mcData) {
46
48
 
47
49
  protocol: mcData.protocol,
48
50
  protocolComments: mcData.protocolComments,
51
+ protocolYaml: [mcData.proto, mcData.types], // bedrock
52
+
53
+ defaultSkin: mcData.steve, // bedrock
49
54
 
50
55
  version: mcData.version,
51
56
 
@@ -10,7 +10,7 @@ Language independent module providing minecraft data for minecraft clients, serv
10
10
  Supports
11
11
  * Minecraft PC version 0.30c (classic), 1.7.10, 1.8.8, 1.9 (15w40b, 1.9, 1.9.1-pre2, 1.9.2, 1.9.4),
12
12
  1.10 (16w20a, 1.10-pre1, 1.10, 1.10.1, 1.10.2), 1.11 (16w35a, 1.11, 1.11.2), 1.12 (17w15a, 17w18b, 1.12-pre4, 1.12, 1.12.1, 1.12.2), 1.13 (17w50a, 1.13, 1.13.1, 1.13.2-pre1, 1.13.2-pre2, 1.13.2), 1.14 (1.14, 1.14.1, 1.14.3, 1.14.4), 1.15 (1.15, 1.15.1, 1.15.2), 1.16 (20w13b, 20w14a, 1.16-rc1, 1.16, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5), and 1.17
13
- * Minecraft bedrock version 0.14, 0.15, 1.0, 1.16.201, 1.16.210, 1.16.220, 1.17.0, 1.17.10
13
+ * Minecraft bedrock version 0.14, 0.15, 1.0, 1.16.201, 1.16.210, 1.16.220, 1.17.0, 1.17.10, 1.17.30, 1.17.40
14
14
 
15
15
  ## Wrappers
16
16
 
@@ -53,7 +53,7 @@ Data provided:
53
53
  | Foods | list of foods each with there id, saturation, foodpoints and more |
54
54
  | Commands | a tree structure for vanilla minecraft server commands, and some info needed to implement sub-parsers.
55
55
  | Legacy | mappings between legacy (1.12) and post-flattening (1.13+) blocks and items ids
56
-
56
+ | Skin data | (bedrock edition) Skin geometry and texture data for steve skin
57
57
 
58
58
  See more information about this data in the [documentation](http://prismarinejs.github.io/minecraft-data/)
59
59