minecraft-data 3.97.0 → 3.98.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.
Files changed (41) hide show
  1. package/data.js +27 -0
  2. package/doc/history.md +4 -0
  3. package/index.d.ts +72 -63
  4. package/minecraft-data/.github/helper-bot/handleMcpcGeneratedArtifacts.js +109 -0
  5. package/minecraft-data/.github/helper-bot/index.js +77 -34
  6. package/minecraft-data/.github/helper-bot/package.json +11 -0
  7. package/minecraft-data/.github/workflows/handle-mcpc-generator.yml +36 -0
  8. package/minecraft-data/.github/workflows/update-helper.yml +3 -2
  9. package/minecraft-data/README.md +1 -1
  10. package/minecraft-data/data/bedrock/1.21.100/protocol.json +2 -2
  11. package/minecraft-data/data/dataPaths.json +28 -1
  12. package/minecraft-data/data/pc/1.21.6/proto.yml +3494 -0
  13. package/minecraft-data/data/pc/1.21.8/attributes.json +247 -0
  14. package/minecraft-data/data/pc/1.21.8/biomes.json +652 -0
  15. package/minecraft-data/data/pc/1.21.8/blockCollisionShapes.json +142541 -0
  16. package/minecraft-data/data/pc/1.21.8/blocks.json +41358 -0
  17. package/minecraft-data/data/pc/1.21.8/effects.json +236 -0
  18. package/minecraft-data/data/pc/1.21.8/enchantments.json +959 -0
  19. package/minecraft-data/data/pc/1.21.8/entities.json +4176 -0
  20. package/minecraft-data/data/pc/1.21.8/foods.json +402 -0
  21. package/minecraft-data/data/pc/1.21.8/instruments.json +94 -0
  22. package/minecraft-data/data/pc/1.21.8/items.json +9284 -0
  23. package/minecraft-data/data/pc/1.21.8/language.json +7394 -0
  24. package/minecraft-data/data/pc/1.21.8/materials.json +206 -0
  25. package/minecraft-data/data/pc/1.21.8/particles.json +458 -0
  26. package/minecraft-data/data/pc/1.21.8/protocol.json +10249 -0
  27. package/minecraft-data/data/pc/1.21.8/recipes.json +30473 -0
  28. package/minecraft-data/data/pc/1.21.8/sounds.json +6914 -0
  29. package/minecraft-data/data/pc/1.21.8/tints.json +465 -0
  30. package/minecraft-data/data/pc/1.21.8/version.json +6 -0
  31. package/minecraft-data/data/pc/common/protocolVersions.json +40 -0
  32. package/minecraft-data/data/pc/common/versions.json +6 -2
  33. package/minecraft-data/data/pc/latest/proto.yml +1 -1
  34. package/minecraft-data/doc/history.md +16 -0
  35. package/minecraft-data/schemas/blockMappings_schema.json +24 -34
  36. package/minecraft-data/schemas/commands_schema.json +13 -7
  37. package/minecraft-data/schemas/tints_schema.json +37 -128
  38. package/minecraft-data/tools/js/extractPcEntityMetadata.js +160 -102
  39. package/minecraft-data/tools/js/test/audit_versions.js +48 -0
  40. package/minecraft-data/tools/js/test/test.js +6 -0
  41. package/package.json +1 -1
package/data.js CHANGED
@@ -1611,6 +1611,33 @@ module.exports =
1611
1611
  get tints () { return require("./minecraft-data/data/pc/1.21.6/tints.json") },
1612
1612
  get version () { return require("./minecraft-data/data/pc/1.21.6/version.json") },
1613
1613
  get windows () { return require("./minecraft-data/data/pc/1.16.1/windows.json") },
1614
+ proto: __dirname + '/minecraft-data/data/pc/1.21.6/proto.yml'
1615
+ },
1616
+ '1.21.8': {
1617
+ get attributes () { return require("./minecraft-data/data/pc/1.21.8/attributes.json") },
1618
+ get blockCollisionShapes () { return require("./minecraft-data/data/pc/1.21.8/blockCollisionShapes.json") },
1619
+ get blocks () { return require("./minecraft-data/data/pc/1.21.8/blocks.json") },
1620
+ get blockLoot () { return require("./minecraft-data/data/pc/1.20/blockLoot.json") },
1621
+ get biomes () { return require("./minecraft-data/data/pc/1.21.8/biomes.json") },
1622
+ get commands () { return require("./minecraft-data/data/pc/1.20.3/commands.json") },
1623
+ get effects () { return require("./minecraft-data/data/pc/1.21.8/effects.json") },
1624
+ get enchantments () { return require("./minecraft-data/data/pc/1.21.8/enchantments.json") },
1625
+ get entities () { return require("./minecraft-data/data/pc/1.21.8/entities.json") },
1626
+ get entityLoot () { return require("./minecraft-data/data/pc/1.20/entityLoot.json") },
1627
+ get foods () { return require("./minecraft-data/data/pc/1.21.8/foods.json") },
1628
+ get instruments () { return require("./minecraft-data/data/pc/1.21.8/instruments.json") },
1629
+ get items () { return require("./minecraft-data/data/pc/1.21.8/items.json") },
1630
+ get language () { return require("./minecraft-data/data/pc/1.21.8/language.json") },
1631
+ get loginPacket () { return require("./minecraft-data/data/pc/1.21.3/loginPacket.json") },
1632
+ get mapIcons () { return require("./minecraft-data/data/pc/1.20.2/mapIcons.json") },
1633
+ get materials () { return require("./minecraft-data/data/pc/1.21.8/materials.json") },
1634
+ get particles () { return require("./minecraft-data/data/pc/1.21.8/particles.json") },
1635
+ get protocol () { return require("./minecraft-data/data/pc/1.21.8/protocol.json") },
1636
+ get recipes () { return require("./minecraft-data/data/pc/1.21.8/recipes.json") },
1637
+ get sounds () { return require("./minecraft-data/data/pc/1.21.8/sounds.json") },
1638
+ get tints () { return require("./minecraft-data/data/pc/1.21.8/tints.json") },
1639
+ get version () { return require("./minecraft-data/data/pc/1.21.8/version.json") },
1640
+ get windows () { return require("./minecraft-data/data/pc/1.16.1/windows.json") },
1614
1641
  proto: __dirname + '/minecraft-data/data/pc/latest/proto.yml'
1615
1642
  }
1616
1643
  },
package/doc/history.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # History
2
2
 
3
+ ## 3.98.0
4
+
5
+ * update `minecraft-data`
6
+
3
7
  ## 3.97.0
4
8
 
5
9
  * update `minecraft-data`
package/index.d.ts CHANGED
@@ -208,27 +208,44 @@ declare namespace MinecraftData {
208
208
  }
209
209
 
210
210
 
211
- type BlockMappingsSchema =
212
- | []
213
- | [
214
- {
215
- pc: {
216
- name: string;
217
- states: {
218
- [k: string]: unknown;
219
- };
220
- [k: string]: unknown;
221
- };
222
- pe: {
223
- name: string;
224
- states: {
225
- [k: string]: unknown;
226
- };
227
- [k: string]: unknown;
228
- };
229
- [k: string]: unknown;
230
- }
231
- ];
211
+ /**
212
+ * Maps block names and states between PC and PE (Bedrock) versions.
213
+ */
214
+ type BlockMappings = {
215
+ pc: BlockRef;
216
+ pe: BlockRef1;
217
+ }[];
218
+
219
+ /**
220
+ * PC (Java Edition) block reference.
221
+ */
222
+ interface BlockRef {
223
+ /**
224
+ * The block's unique name identifier.
225
+ */
226
+ name: string;
227
+ /**
228
+ * The block's state properties as key-value pairs.
229
+ */
230
+ states: {
231
+ [k: string]: unknown;
232
+ };
233
+ }
234
+ /**
235
+ * PE (Bedrock Edition) block reference.
236
+ */
237
+ interface BlockRef1 {
238
+ /**
239
+ * The block's unique name identifier.
240
+ */
241
+ name: string;
242
+ /**
243
+ * The block's state properties as key-value pairs.
244
+ */
245
+ states: {
246
+ [k: string]: unknown;
247
+ };
248
+ }
232
249
 
233
250
 
234
251
  type Blocks = Block[];
@@ -350,9 +367,8 @@ declare namespace MinecraftData {
350
367
 
351
368
 
352
369
  interface HttpsExampleComPersonSchemaJson {
353
- graph?: RootNode;
370
+ root: RootNode;
354
371
  parsers: ParserInfo[];
355
- [k: string]: unknown;
356
372
  }
357
373
  interface RootNode {
358
374
  type: "root";
@@ -360,7 +376,6 @@ declare namespace MinecraftData {
360
376
  executable: boolean;
361
377
  redirects: string[];
362
378
  children: (LiteralNode | ArgumentNode)[];
363
- [k: string]: unknown;
364
379
  }
365
380
  interface LiteralNode {
366
381
  type: "literal";
@@ -368,7 +383,6 @@ declare namespace MinecraftData {
368
383
  executable: boolean;
369
384
  redirects: string[];
370
385
  children: (LiteralNode | ArgumentNode)[];
371
- [k: string]: unknown;
372
386
  }
373
387
  interface ArgumentNode {
374
388
  type: "argument";
@@ -381,9 +395,7 @@ declare namespace MinecraftData {
381
395
  modifier?: {
382
396
  [k: string]: unknown;
383
397
  } | null;
384
- [k: string]: unknown;
385
398
  };
386
- [k: string]: unknown;
387
399
  }
388
400
  interface ParserInfo {
389
401
  parser: string;
@@ -391,7 +403,6 @@ declare namespace MinecraftData {
391
403
  [k: string]: unknown;
392
404
  } | null;
393
405
  examples: string[];
394
- [k: string]: unknown;
395
406
  }
396
407
 
397
408
 
@@ -903,41 +914,39 @@ declare namespace MinecraftData {
903
914
 
904
915
 
905
916
  interface Tints {
906
- grass?: {
907
- data?: {
908
- keys?: string[];
909
- color?: number;
910
- }[];
911
- default?: number;
912
- };
913
- foliage?: {
914
- data?: {
915
- keys?: string[];
916
- color?: number;
917
- }[];
918
- default?: number;
919
- };
920
- water?: {
921
- data?: {
922
- keys?: string[];
923
- color?: number;
924
- }[];
925
- default?: number;
926
- };
927
- redstone?: {
928
- data?: {
929
- keys?: number[];
930
- color?: number;
931
- }[];
932
- default?: number;
933
- };
934
- constant?: {
935
- data?: {
936
- keys?: string[];
937
- color?: number;
938
- }[];
939
- default?: number;
940
- };
917
+ grass: StringKeyTintGroup;
918
+ foliage: StringKeyTintGroup;
919
+ water: StringKeyTintGroup;
920
+ redstone: IntegerKeyTintGroup;
921
+ constant: StringKeyTintGroup;
922
+ }
923
+ interface StringKeyTintGroup {
924
+ /**
925
+ * @minItems 1
926
+ */
927
+ data: [StringKeyTintEntry, ...StringKeyTintEntry[]];
928
+ default?: number;
929
+ }
930
+ interface StringKeyTintEntry {
931
+ /**
932
+ * @minItems 1
933
+ */
934
+ keys: [string, ...string[]];
935
+ color: number;
936
+ }
937
+ interface IntegerKeyTintGroup {
938
+ /**
939
+ * @minItems 1
940
+ */
941
+ data: [IntegerKeyTintEntry, ...IntegerKeyTintEntry[]];
942
+ default?: number;
943
+ }
944
+ interface IntegerKeyTintEntry {
945
+ /**
946
+ * @minItems 1
947
+ */
948
+ keys: [number, ...number[]];
949
+ color: number;
941
950
  }
942
951
 
943
952
 
@@ -0,0 +1,109 @@
1
+ const fs = require('fs')
2
+ const cp = require('child_process')
3
+ const github = require('gh-helpers')()
4
+ const { join } = require('path')
5
+ const { extractPcEntityMetadata } = require('../../tools/js/extractPcEntityMetadata')
6
+
7
+ function exec (file, args = [], options = {}) {
8
+ const opts = { stdio: 'inherit', ...options }
9
+ console.log('> ', file, args.join(' '), options.cwd ? `(cwd: ${options.cwd})` : '')
10
+ return github.mock ? undefined : cp.execFileSync(file, args, opts)
11
+ }
12
+
13
+ const artifactsDir = join(__dirname, './artifacts')
14
+ const root = join(__dirname, '..', '..')
15
+
16
+ async function handle (ourPR, genPullNo, version, artifactURL) {
17
+ const branchNameVersion = version.replace(/[^a-zA-Z0-9]/g, '_').toLowerCase()
18
+ const branch = ourPR.headBranch || `pc-${branchNameVersion}`
19
+ exec('git', ['pull', 'origin'])
20
+
21
+ // if external PR:
22
+ // const branch = ourPR.headBranch
23
+ // exec('git', ['remote', 'add', 'fo', ourPR.headCloneURL])
24
+ // exec('git', ['fetch', 'fo', branch])
25
+ // exec('git', ['checkout', '-b', branch, `fo/` + branch])
26
+
27
+ try {
28
+ exec('git', ['checkout', branch])
29
+ } catch (err) {
30
+ console.error('Error checking out branch:', err)
31
+ process.exit(1)
32
+ }
33
+
34
+ const dataPaths = require('../../data/dataPaths.json')
35
+ const dataPath = dataPaths.pc[version]
36
+
37
+ const destDir = join(root, `./data/pc/${version}`)
38
+ if (!fs.existsSync(destDir) || !dataPath) {
39
+ console.warn(`⚠️ Version ${version} not found (checked ${destDir}) ; cannot continue.`, fs.existsSync(destDir), dataPath)
40
+ process.exit(1)
41
+ }
42
+
43
+ if (ourPR.body) {
44
+ await github.updateIssue(ourPR.number, {
45
+ body: ourPR.body.replace('<!--minecraft-data-generator-placeholder-->', `- https://github.com/PrismarineJS/minecraft-data-generator/pull/${genPullNo}`)
46
+ })
47
+ }
48
+
49
+ console.log('Handling PR:', ourPR)
50
+
51
+ fs.mkdirSync(artifactsDir, { recursive: true })
52
+
53
+ // https://github.com/PrismarineJS/minecraft-data-generator/actions/runs/17261281146/artifacts/3861320839
54
+ const s = artifactURL.split('github.com/')[1]
55
+ const [ownerName, repoName, _actions, _runs, _runId, _artifacts, artifactId] = s.split('/')
56
+ console.log('Downloading artifacts', { ownerName, repoName, artifactId, artifactsDir })
57
+ await github.artifacts.downloadIdFrom(ownerName, repoName, artifactId, artifactsDir)
58
+
59
+ console.log(fs.readdirSync(artifactsDir))
60
+
61
+ // Now copy artifacts/${version}/*.json to data/pc/$version/*.json
62
+ const versionArtifactsDir = join(artifactsDir, version)
63
+ for (const file of fs.readdirSync(versionArtifactsDir)) {
64
+ if (file.endsWith('.json')) {
65
+ const src = join(versionArtifactsDir, file)
66
+ const dest = join(destDir, file)
67
+ fs.mkdirSync(destDir, { recursive: true })
68
+ console.log(`copy ${src} => ${dest}`)
69
+ fs.copyFileSync(src, dest)
70
+ dataPath[file.replace('.json', '')] = 'pc/' + version
71
+ }
72
+ }
73
+
74
+ // Commit the new dataPath
75
+ fs.writeFileSync(join(root, 'data', 'dataPaths.json'), JSON.stringify(dataPaths, null, 2))
76
+
77
+ try {
78
+ process.chdir(join(__dirname, '../../tools/js'))
79
+ extractPcEntityMetadata(version, version, { write: true, cloneIfMissing: true })
80
+ } catch (e) {
81
+ console.log('Failed to extract PC entity metadata', e)
82
+ }
83
+
84
+ // Now, we need to commit the changes
85
+ exec('git', ['config', 'user.name', 'github-actions[bot]'])
86
+ exec('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com'])
87
+ exec('git', ['add', '--all'])
88
+ exec('git', ['commit', '-m', `[Auto] Apply generated data from PrismarineJS/minecraft-data-generator#${genPullNo}`])
89
+ exec('git', ['push', 'origin', branch])
90
+ }
91
+
92
+ async function main (versions, genPullNo, artifactUrl) {
93
+ const version = versions.at(-1)
94
+ const pr = await github.findPullRequest({ titleIncludes: '🎈', author: null })
95
+ console.log('Found PR', pr)
96
+ if (pr && pr.isOpen) {
97
+ const details = await github.getPullRequest(pr.id)
98
+ console.log('PR', details)
99
+ await handle(details, genPullNo, version, artifactUrl)
100
+ } else {
101
+ process.exit(1)
102
+ }
103
+ }
104
+
105
+ main(
106
+ JSON.parse(process.env.TRIGGER_MC_VERSIONS),
107
+ process.env.TRIGGER_PR_NO,
108
+ process.env.TRIGGER_ARTIFACT_URL
109
+ )
@@ -1,11 +1,15 @@
1
1
  const fs = require('fs')
2
2
  const cp = require('child_process')
3
3
  const github = require('gh-helpers')()
4
- const exec = (cmd) => github.mock ? console.log('> ', cmd) : (console.log('> ', cmd), cp.execSync(cmd, { stdio: 'inherit' }))
5
4
  const pcManifestURL = 'https://launchermeta.mojang.com/mc/game/version_manifest.json'
6
5
  const changelogURL = 'https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs'
7
6
 
8
- const download = (url, dest) => exec(`curl -L ${url} -o ${dest}`)
7
+ function exec (file, args, options = {}) {
8
+ const opts = { stdio: 'inherit', ...options }
9
+ console.log('> ', file, args.join(' '), options.cwd ? `(cwd: ${options.cwd})` : '')
10
+ return github.mock ? undefined : cp.execFileSync(file, args, opts)
11
+ }
12
+ const download = (url, dest) => exec('curl', ['-L', url, '-o', dest])
9
13
 
10
14
  function buildFirstIssue (title, result, jarData) {
11
15
  const protocolVersion = jarData?.protocol_version || 'Failed to obtain from JAR'
@@ -28,6 +32,7 @@ A new Minecraft Java Edition version is available (as of ${date}), version **${r
28
32
  <tr><td><b>Data Version</b></td><td>${jarData?.world_version}</td>
29
33
  <tr><td><b>Java Version</b></td><td>${jarData?.java_version}</td>
30
34
  </table>
35
+
31
36
  <hr/>
32
37
  🤖 I am a bot, I check for updates every 2 hours without a trigger. You can close this issue to prevent any further updates.
33
38
  `
@@ -35,17 +40,36 @@ A new Minecraft Java Edition version is available (as of ${date}), version **${r
35
40
  }
36
41
 
37
42
  async function createInitialPull (edition, issueUrl, { version, protocolVersion }) {
38
- exec('cd tools/js && npm install')
39
- exec(`cd tools/js && npm run version ${edition} ${version} ${protocolVersion}`)
40
- const branchNameVersion = version.replace(/[^a-zA-Z0-9]/g, '.').toLowerCase()
43
+ exec('npm', ['install'], { cwd: 'tools/js' })
44
+ exec('npm', ['run', 'version', edition, version, protocolVersion], { cwd: 'tools/js' })
45
+ exec('npm', ['run', 'build'], { cwd: 'tools/js' })
46
+ const branchNameVersion = version.replace(/[^a-zA-Z0-9]/g, '_').toLowerCase()
41
47
  const branchName = `${edition}-${branchNameVersion}`
42
- const title = `Initial data for ${edition} ${version}`
43
- exec(`git checkout -b ${branchName}`)
44
- exec(`git add --all`)
45
- exec(`git commit -m "${title}"`)
46
- exec(`git push origin ${branchName}`)
47
- // createPullRequest(title: string, body: string, fromBranch: string, intoBranch?: string): Promise<{ number: number, url: string }>;
48
- const pr = await github.createPullRequest(title, `${title}.\n\nRef: ${issueUrl}`, branchName, 'master')
48
+ const title = `🎈 Add Minecraft ${edition} ${version} data`
49
+ // First, delete any existing branch
50
+ try {
51
+ exec('git', ['branch', '-D', branchName])
52
+ } catch (e) {
53
+ // Branch doesn't exist, ignore error
54
+ }
55
+ exec('git', ['checkout', '-b', branchName])
56
+ exec('git', ['config', 'user.name', 'github-actions[bot]'])
57
+ exec('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com'])
58
+ exec('git', ['add', '--all'])
59
+ exec('git', ['commit', '-m', title])
60
+ exec('git', ['push', 'origin', branchName, '--force'])
61
+ const body = `
62
+ This automated PR sets up the relevant boilerplate for Minecraft ${edition} version ${version}. Fixes ${issueUrl}.
63
+
64
+ Related:
65
+ - Issue: ${issueUrl}
66
+ - Protocol Version: ${protocolVersion}
67
+ <!--minecraft-data-generator-placeholder-->
68
+
69
+ * You can help contribute to this PR by opening a PR against this <code branch>${branchName}</code> branch instead of <code>master</code>.
70
+ `
71
+ const pr = await github.createPullRequest(title, body, branchName, 'master')
72
+ pr.branchName = branchName
49
73
  return pr
50
74
  }
51
75
 
@@ -63,11 +87,21 @@ async function updateManifestPC () {
63
87
  // fs.writeFileSync('./manifest.json', JSON.stringify(manifest, null, 2))
64
88
  const knownVersions = protocolVersions.pc.reduce((acc, cur) => (acc[cur.minecraftVersion] = cur, acc), {})
65
89
  const latestVersion = manifest.latest.snapshot
90
+ const latestReleaseVersion = manifest.latest.release
66
91
  const latestVersionData = manifest.versions.find(v => v.id === latestVersion)
67
92
  const latestVersionIsSnapshot = latestVersionData.type !== 'release'
68
93
 
69
- const title = `Support Minecraft PC ${latestVersion}`
70
- const issueStatus = await github.findIssue({ titleIncludes: title }) || {}
94
+ const title = `Support Minecraft PC ${latestReleaseVersion}`
95
+ const issueStatus = await github.findIssue({ titleIncludes: title, author: null }) || {}
96
+ console.log('issueStatus', issueStatus)
97
+
98
+ if (issueStatus?.isOpen) {
99
+ if (supportedVersions.pc.includes(latestReleaseVersion)) {
100
+ // If the issue is open and the latest release version is supported, we can close the issue
101
+ github.close(issueStatus.id, `Closing as PC ${latestReleaseVersion} is now supported`)
102
+ return
103
+ }
104
+ }
71
105
 
72
106
  if (latestVersionIsSnapshot) {
73
107
  // don't make issues for snapshots
@@ -75,19 +109,11 @@ async function updateManifestPC () {
75
109
  console.log('Latest version is a known snapshot, no work to do')
76
110
  return
77
111
  }
112
+ } else if (knownVersions[latestVersion]) {
113
+ console.log(`Latest PC version ${latestVersion} is known in protocolVersions.json, but not in versions.json (protocol version ${knownVersions[latestVersion].version})`)
114
+ return // We expect to have already handled this version.
78
115
  } else {
79
- if (supportedVersions.pc.includes(latestVersion)) {
80
- if (issueStatus.isOpen) {
81
- github.close(issueStatus.id, `Closing as PC ${latestVersion} is now supported`)
82
- }
83
- console.log('Latest PC version is supported.')
84
- return
85
- } else if (knownVersions[latestVersion]) {
86
- console.log(`Latest PC version ${latestVersion} is known in protocolVersions.json, but not in versions.json (protocol version ${knownVersions[latestVersion].version})`)
87
- return
88
- } else {
89
- console.log(`Latest PC version ${latestVersion} is not known in protocolVersions.json, adding and making issue`)
90
- }
116
+ console.log(`Latest PC version ${latestVersion} is not known in protocolVersions.json, adding and making issue`)
91
117
  }
92
118
 
93
119
  let versionJson
@@ -131,11 +157,28 @@ async function updateManifestPC () {
131
157
  workflow: 'handle-mcdata-update.yml',
132
158
  branch: 'main',
133
159
  inputs: {
134
- version: latestVersion
160
+ version: latestVersion,
161
+ issue_number: issue?.number,
162
+ pr_number: pr?.number
135
163
  }
136
164
  }
137
165
  console.log('Sending workflow dispatch', dispatchPayload)
138
166
  await github.sendWorkflowDispatch(dispatchPayload)
167
+ // Ask node-minecraft-protocol to handle new update
168
+ const nodeDispatchPayload = {
169
+ owner: 'PrismarineJS',
170
+ repo: 'node-minecraft-protocol',
171
+ workflow: 'update-from-minecraft-data.yml',
172
+ branch: 'master',
173
+ inputs: {
174
+ new_mc_version: latestVersion,
175
+ mcdata_branch: pr.branchName,
176
+ mcdata_pr_url: pr.url
177
+ }
178
+ }
179
+ console.log('Sending workflow dispatch', nodeDispatchPayload)
180
+ await github.sendWorkflowDispatch(nodeDispatchPayload)
181
+ // node-minecraft-protocol would then dispatch to mineflayer
139
182
  }
140
183
 
141
184
  async function addEntryFor (releaseVersion, releaseData) {
@@ -152,8 +195,8 @@ async function updateManifestPC () {
152
195
  console.log(`Downloaded client jar ${releaseVersion}.jar (${clientJarSize} bytes), extracting its version.json...`)
153
196
 
154
197
  // unzip with tar / unzip, Actions image uses 7z
155
- if (process.platform === 'win32') cp.execSync(`tar -xf ./${releaseVersion}.jar version.json`)
156
- else cp.execSync(`7z -y e ./${releaseVersion}.jar version.json`, { stdio: 'inherit' })
198
+ if (process.platform === 'win32') exec('tar', ['-xf', `./${releaseVersion}.jar`, 'version.json'])
199
+ else exec('7z', ['-y', 'e', `./${releaseVersion}.jar`, 'version.json'])
157
200
  const versionJson = require('./version.json')
158
201
 
159
202
  let majorVersion
@@ -179,11 +222,11 @@ async function updateManifestPC () {
179
222
  if (process.env.CI) {
180
223
  console.log('Committing changes to protocolVersions.json')
181
224
  // https://github.com/actions/checkout/pull/1184
182
- cp.execSync('git config user.name "github-actions[bot]"')
183
- cp.execSync('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"')
184
- cp.execSync('git add ../../data/pc/common/protocolVersions.json')
185
- cp.execSync(`git commit -m "Add ${versionJson.id} to pc protocolVersions.json"`)
186
- cp.execSync('git push')
225
+ exec('git', ['config', 'user.name', 'github-actions[bot]'])
226
+ exec('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com'])
227
+ exec('git', ['add', '../../data/pc/common/protocolVersions.json'])
228
+ exec('git', ['commit', '-m', `Add ${versionJson.id} to pc protocolVersions.json`])
229
+ exec('git', ['push'])
187
230
  }
188
231
 
189
232
  return versionJson
@@ -0,0 +1,11 @@
1
+ {
2
+ "scripts": {
3
+ "fix": "standard --fix"
4
+ },
5
+ "dependencies": {
6
+ "gh-helpers": "^1.0.0"
7
+ },
8
+ "devDependencies": {
9
+ "standard": "^17.1.2"
10
+ }
11
+ }
@@ -0,0 +1,36 @@
1
+ name: handle-mcpc-generator
2
+ on:
3
+ workflow_dispatch:
4
+ inputs:
5
+ versions:
6
+ description: 'JSON stringified list of known versions in generator (last is expected to be latest)'
7
+ required: true
8
+ default: '["1.21.6"]'
9
+ mergedArtifactURL:
10
+ description: 'Merged artifact download URL'
11
+ required: true
12
+ prNumber:
13
+ description: 'Relevant minecraft-data-generator PR #'
14
+ required: false
15
+
16
+ jobs:
17
+ update-mcdata:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ with:
22
+ submodules: true
23
+ - name: Use Node.js 22.x
24
+ uses: actions/setup-node@v1
25
+ with:
26
+ node-version: 22.x
27
+ - name: Expose GitHub Runtime
28
+ uses: crazy-max/ghaction-github-runtime@v3
29
+ - run: cd .github/helper-bot && npm install
30
+ - run: cd tools/js && npm install
31
+ - run: cd .github/helper-bot && node handleMcpcGeneratedArtifacts.js
32
+ env:
33
+ TRIGGER_MC_VERSIONS: ${{ github.event.inputs.versions }}
34
+ TRIGGER_PR_NO: ${{ github.event.inputs.prNumber }}
35
+ TRIGGER_ARTIFACT_URL: ${{ github.event.inputs.mergedArtifactURL }}
36
+ GITHUB_TOKEN: ${{ secrets.PAT_PASSWORD }}
@@ -16,10 +16,11 @@ jobs:
16
16
  with:
17
17
  node-version: 22.0.0
18
18
  - name: Install Github Actions toolkit
19
- run: npm i gh-helpers
19
+ run: npm i
20
20
  working-directory: .github/helper-bot
21
21
  # The env vars contain the relevant trigger information, so we don't need to pass it
22
22
  - name: Runs helper
23
- run: cd .github/helper-bot && node index.js
23
+ run: node index.js
24
+ working-directory: .github/helper-bot
24
25
  env:
25
26
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -9,7 +9,7 @@ Language independent module providing minecraft data for minecraft clients, serv
9
9
 
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
- 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), 1.17, 1.17.1, 1.18 (1.18, 1.18.1, 1.18.2), 1.19 (1.19, 1.19.2, 1.19.3, 1.19.4), 1.20 (1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6), 1.21 (1.21, 1.21.1, 1.21.3)
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), 1.17, 1.17.1, 1.18 (1.18, 1.18.1, 1.18.2), 1.19 (1.19, 1.19.2, 1.19.3, 1.19.4), 1.20 (1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6), 1.21 (1.21, 1.21.1, 1.21.3), 1.21.8
13
13
  <!--NEXT PC-->
14
14
  * 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, 1.18.0, 1.18.11, 1.18.30, 1.19.1, 1.19.10, 1.19.20, 1.19.21, 1.19.30, 1.19.40, 1.19.50, 1.19.60, 1.19.62, 1.19.63, 1.19.70, 1.19.80, 1.20.0, 1.20.10, 1.20.30, 1.20.40, 1.20.50, 1.20.61, 1.20.71, 1.20.80, 1.21.0, 1.21.2, 1.21.20, 1.21.30, 1.21.42, 1.21.50, 1.21.60, 1.21.70, 1.21.80, 1.21.90, 1.21.93, 1.21.100
15
15
  <!--NEXT BEDROCK-->
@@ -12000,7 +12000,7 @@
12000
12000
  "type": [
12001
12001
  "option",
12002
12002
  "lf32"
12003
- ]
12003
+ ]
12004
12004
  },
12005
12005
  {
12006
12006
  "name": "on_ground",
@@ -14329,4 +14329,4 @@
14329
14329
  ]
14330
14330
  ]
14331
14331
  }
14332
- }
14332
+ }
@@ -1610,6 +1610,33 @@
1610
1610
  "tints": "pc/1.21.6",
1611
1611
  "version": "pc/1.21.6",
1612
1612
  "windows": "pc/1.16.1",
1613
+ "proto": "pc/1.21.6"
1614
+ },
1615
+ "1.21.8": {
1616
+ "attributes": "pc/1.21.8",
1617
+ "blockCollisionShapes": "pc/1.21.8",
1618
+ "blocks": "pc/1.21.8",
1619
+ "blockLoot": "pc/1.20",
1620
+ "biomes": "pc/1.21.8",
1621
+ "commands": "pc/1.20.3",
1622
+ "effects": "pc/1.21.8",
1623
+ "enchantments": "pc/1.21.8",
1624
+ "entities": "pc/1.21.8",
1625
+ "entityLoot": "pc/1.20",
1626
+ "foods": "pc/1.21.8",
1627
+ "instruments": "pc/1.21.8",
1628
+ "items": "pc/1.21.8",
1629
+ "language": "pc/1.21.8",
1630
+ "loginPacket": "pc/1.21.3",
1631
+ "mapIcons": "pc/1.20.2",
1632
+ "materials": "pc/1.21.8",
1633
+ "particles": "pc/1.21.8",
1634
+ "protocol": "pc/1.21.8",
1635
+ "recipes": "pc/1.21.8",
1636
+ "sounds": "pc/1.21.8",
1637
+ "tints": "pc/1.21.8",
1638
+ "version": "pc/1.21.8",
1639
+ "windows": "pc/1.16.1",
1613
1640
  "proto": "pc/latest"
1614
1641
  }
1615
1642
  },
@@ -2568,4 +2595,4 @@
2568
2595
  "language": "bedrock/1.21.70"
2569
2596
  }
2570
2597
  }
2571
- }
2598
+ }