minecraft-data 3.32.0 → 3.34.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 (36) hide show
  1. package/.github/workflows/npm-publish.yml +1 -2
  2. package/data.js +24 -0
  3. package/doc/history.md +8 -0
  4. package/index.d.ts +8 -4
  5. package/minecraft-data/.github/helper-bot/github-helper.js +59 -0
  6. package/minecraft-data/.github/helper-bot/index.js +158 -0
  7. package/minecraft-data/.github/workflows/build-gh-pages.yml +2 -2
  8. package/minecraft-data/.github/workflows/update-helper.yml +25 -0
  9. package/minecraft-data/README.md +2 -1
  10. package/minecraft-data/data/dataPaths.json +24 -0
  11. package/minecraft-data/data/pc/1.19.3/protocol.json +3 -3
  12. package/minecraft-data/data/pc/1.19.4/biomes.json +632 -0
  13. package/minecraft-data/data/pc/1.19.4/blockCollisionShapes.json +121985 -0
  14. package/minecraft-data/data/pc/1.19.4/blocks.json +36728 -0
  15. package/minecraft-data/data/pc/1.19.4/effects.json +200 -0
  16. package/minecraft-data/data/pc/1.19.4/enchantments.json +875 -0
  17. package/minecraft-data/data/pc/1.19.4/entities.json +1242 -0
  18. package/minecraft-data/data/pc/1.19.4/foods.json +402 -0
  19. package/minecraft-data/data/pc/1.19.4/instruments.json +94 -0
  20. package/minecraft-data/data/pc/1.19.4/items.json +8079 -0
  21. package/minecraft-data/data/pc/1.19.4/language.json +6065 -0
  22. package/minecraft-data/data/pc/1.19.4/materials.json +154 -0
  23. package/minecraft-data/data/pc/1.19.4/particles.json +386 -0
  24. package/minecraft-data/data/pc/1.19.4/protocol.json +6734 -0
  25. package/minecraft-data/data/pc/1.19.4/recipes.json +27202 -0
  26. package/minecraft-data/data/pc/1.19.4/tints.json +429 -0
  27. package/minecraft-data/data/pc/1.19.4/version.json +5 -0
  28. package/minecraft-data/data/pc/common/features.json +5 -0
  29. package/minecraft-data/data/pc/common/protocolVersions.json +7 -0
  30. package/minecraft-data/data/pc/common/versions.json +2 -1
  31. package/minecraft-data/doc/history.md +6 -0
  32. package/minecraft-data/schemas/biomes_schema.json +7 -5
  33. package/minecraft-data/tools/js/package.json +1 -0
  34. package/minecraft-data/tools/js/syncPcParticleIds.js +23 -0
  35. package/package.json +5 -5
  36. package/minecraft-data/.git +0 -1
@@ -3,7 +3,6 @@ on:
3
3
  push:
4
4
  branches:
5
5
  - master
6
- - dependabot/npm_and_yarn/json-schema-to-typescript-12.0.0
7
6
  workflow_dispatch:
8
7
  jobs:
9
8
  npm-publish:
@@ -17,7 +16,7 @@ jobs:
17
16
  - name: Set up Node.js
18
17
  uses: actions/setup-node@master
19
18
  with:
20
- node-version: 10.0.0
19
+ node-version: 18.0.0
21
20
  - run: npm install
22
21
  - id: publish
23
22
  uses: JS-DevTools/npm-publish@v1
package/data.js CHANGED
@@ -1177,6 +1177,30 @@ module.exports =
1177
1177
  get loginPacket () { return require("./minecraft-data/data/pc/1.19.2/loginPacket.json") },
1178
1178
  get tints () { return require("./minecraft-data/data/pc/1.19.3/tints.json") },
1179
1179
  get mapIcons () { return require("./minecraft-data/data/pc/1.16/mapIcons.json") }
1180
+ },
1181
+ '1.19.4': {
1182
+ get attributes () { return require("./minecraft-data/data/pc/1.17/attributes.json") },
1183
+ get blocks () { return require("./minecraft-data/data/pc/1.19.4/blocks.json") },
1184
+ get blockCollisionShapes () { return require("./minecraft-data/data/pc/1.19.4/blockCollisionShapes.json") },
1185
+ get biomes () { return require("./minecraft-data/data/pc/1.19.4/biomes.json") },
1186
+ get effects () { return require("./minecraft-data/data/pc/1.19.4/effects.json") },
1187
+ get items () { return require("./minecraft-data/data/pc/1.19.4/items.json") },
1188
+ get enchantments () { return require("./minecraft-data/data/pc/1.19.4/enchantments.json") },
1189
+ get recipes () { return require("./minecraft-data/data/pc/1.19.4/recipes.json") },
1190
+ get instruments () { return require("./minecraft-data/data/pc/1.19.4/instruments.json") },
1191
+ get materials () { return require("./minecraft-data/data/pc/1.19.4/materials.json") },
1192
+ get language () { return require("./minecraft-data/data/pc/1.19.4/language.json") },
1193
+ get entities () { return require("./minecraft-data/data/pc/1.19.4/entities.json") },
1194
+ get protocol () { return require("./minecraft-data/data/pc/1.19.4/protocol.json") },
1195
+ get windows () { return require("./minecraft-data/data/pc/1.16.1/windows.json") },
1196
+ get version () { return require("./minecraft-data/data/pc/1.19.4/version.json") },
1197
+ get foods () { return require("./minecraft-data/data/pc/1.19.4/foods.json") },
1198
+ get particles () { return require("./minecraft-data/data/pc/1.19.4/particles.json") },
1199
+ get blockLoot () { return require("./minecraft-data/data/pc/1.19/blockLoot.json") },
1200
+ get entityLoot () { return require("./minecraft-data/data/pc/1.19/entityLoot.json") },
1201
+ get loginPacket () { return require("./minecraft-data/data/pc/1.19.2/loginPacket.json") },
1202
+ get tints () { return require("./minecraft-data/data/pc/1.19.4/tints.json") },
1203
+ get mapIcons () { return require("./minecraft-data/data/pc/1.16/mapIcons.json") }
1180
1204
  }
1181
1205
  },
1182
1206
  'bedrock': {
package/doc/history.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # History
2
2
 
3
+ ## 3.34.0
4
+
5
+ * update `minecraft-data`
6
+
7
+ ## 3.33.0
8
+
9
+ * update `minecraft-data`
10
+
3
11
  ## 3.32.0
4
12
 
5
13
  * update `minecraft-data`
package/index.d.ts CHANGED
@@ -34,9 +34,13 @@ declare namespace MinecraftData {
34
34
  */
35
35
  temperature: number;
36
36
  /**
37
- * The type of precipitation: none, rain or snow
37
+ * The type of precipitation: none, rain or snow [before 1.19.4]
38
38
  */
39
- precipitation: string;
39
+ precipitation?: string;
40
+ /**
41
+ * True if a biome has any precipitation (rain or snow) [1.19.4+]
42
+ */
43
+ has_precipitation?: boolean;
40
44
  /**
41
45
  * The dimension of a biome: overworld, nether or end
42
46
  */
@@ -50,9 +54,9 @@ declare namespace MinecraftData {
50
54
  */
51
55
  color: number;
52
56
  /**
53
- * How much rain there is in a biome
57
+ * How much rain there is in a biome [before 1.19.4]
54
58
  */
55
- rainfall: number;
59
+ rainfall?: number;
56
60
  [k: string]: unknown;
57
61
  }
58
62
 
@@ -0,0 +1,59 @@
1
+ if (!process.env.CI) {
2
+ // mock a bunch of things for testing locally -- https://github.com/actions/toolkit/issues/71
3
+ process.env.GITHUB_REPOSITORY = 'PrismarineJS/minecraft-data'
4
+ process.env.GITHUB_EVENT_NAME = 'issue_comment'
5
+ process.env.GITHUB_SHA = 'cb2fd97b6eae9f2c7fee79d5a86eb9c3b4ac80d8'
6
+ process.env.GITHUB_REF = 'refs/heads/master'
7
+ process.env.GITHUB_WORKFLOW = 'Issue comments'
8
+ process.env.GITHUB_ACTION = 'run1'
9
+ process.env.GITHUB_ACTOR = 'test-user'
10
+ module.exports = { getIssueStatus: () => ({}), updateIssue: () => {}, createIssue: () => {} }
11
+ return
12
+ }
13
+
14
+ // const { Octokit } = require('@octokit/rest') // https://github.com/octokit/rest.js
15
+ const github = require('@actions/github')
16
+
17
+ const token = process.env.GITHUB_TOKEN
18
+ const octokit = github.getOctokit(token)
19
+ const context = github.context
20
+
21
+ async function getIssueStatus (title) {
22
+ // https://docs.github.com/en/rest/reference/search#search-issues-and-pull-requests
23
+ const existingIssues = await octokit.rest.search.issuesAndPullRequests({
24
+ q: `is:issue repo:${process.env.GITHUB_REPOSITORY} in:title ${title}`
25
+ })
26
+ // console.log('Existing issues', existingIssues)
27
+ const existingIssue = existingIssues.data.items.find(issue => issue.title === title)
28
+
29
+ if (!existingIssue) return {}
30
+
31
+ return { open: existingIssue.state === 'open', closed: existingIssue.state === 'closed', id: existingIssue.number }
32
+ }
33
+
34
+ async function updateIssue (id, payload) {
35
+ const issue = await octokit.rest.issues.update({
36
+ ...context.repo,
37
+ issue_number: id,
38
+ body: payload.body
39
+ })
40
+ console.log(`Updated issue ${issue.data.title}#${issue.data.number}: ${issue.data.html_url}`)
41
+ }
42
+
43
+ async function createIssue (payload) {
44
+ const issue = await octokit.rest.issues.create({
45
+ ...context.repo,
46
+ ...payload
47
+ })
48
+ console.log(`Created issue ${issue.data.title}#${issue.data.number}: ${issue.data.html_url}`)
49
+ }
50
+
51
+ async function close (id, reason) {
52
+ if (reason) await octokit.rest.issues.createComment({ ...context.repo, issue_number: id, body: reason })
53
+ const issue = await octokit.rest.issues.update({ ...context.repo, issue_number: id, state: 'closed' })
54
+ console.log(`Closed issue ${issue.data.title}#${issue.data.number}: ${issue.data.html_url}`)
55
+ }
56
+
57
+ if (process.env.CI) {
58
+ module.exports = { getIssueStatus, updateIssue, createIssue, close }
59
+ }
@@ -0,0 +1,158 @@
1
+ const fs = require('fs')
2
+ const cp = require('child_process')
3
+ const https = require('https')
4
+ const helper = require('./github-helper')
5
+ const pcManifestURL = 'https://launchermeta.mojang.com/mc/game/version_manifest.json'
6
+ const changelogURL = 'https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs'
7
+
8
+ // this is a polyfill for node <18
9
+ const fetch = globalThis.fetch || function (url) {
10
+ return new Promise((resolve, reject) => {
11
+ https.get(url, (res) => {
12
+ let data = ''
13
+ res.on('data', (chunk) => {
14
+ data += chunk
15
+ })
16
+ res.on('end', () => {
17
+ resolve({
18
+ ok: true,
19
+ text: () => Promise.resolve(data),
20
+ json: () => Promise.resolve(JSON.parse(data))
21
+ })
22
+ })
23
+ }).on('error', reject)
24
+ })
25
+ }
26
+ const download = (url, dest) => cp.execSync(`curl -L ${url} -o ${dest}`)
27
+
28
+ function buildFirstIssue (title, result, jarData) {
29
+ const protocolVersion = jarData?.protocol_version || 'Failed to obtain from JAR'
30
+ const name = jarData?.name || result.id
31
+ const date = result.releaseTime
32
+
33
+ return {
34
+ title,
35
+ body: `
36
+ A new Minecraft Java Edition version is available (as of ${date}), version **${result.id}**
37
+ ## Official Changelog
38
+ * ${changelogURL}
39
+ ## Protocol Details
40
+ (I will close this issue automatically if "${result.id}" is added to data/pc/common/versions.json on "master")
41
+ <table>
42
+ <tr><td><b>Name</b></td><td>${name}</td>
43
+ <tr><td><b>Protocol ID</b></td><td>${protocolVersion}</td>
44
+ <tr><td><b>Release Date</b></td><td>${date}</td>
45
+ <tr><td><b>Release Type</b></td><td>${result.type}</td>
46
+ <tr><td><b>Data Version</b></td><td>${jarData?.world_version}</td>
47
+ <tr><td><b>Java Version</b></td><td>${jarData?.java_version}</td>
48
+ </table>
49
+ <hr/>
50
+ 🤖 I am a bot, I check for updates every 2 hours without a trigger. You can close this issue to prevent any further updates.
51
+ `
52
+ }
53
+ }
54
+
55
+ const protocolVersions = {
56
+ pc: require('../../data/pc/common/protocolVersions.json'),
57
+ bedrock: require('../../data/bedrock/common/protocolVersions.json')
58
+ }
59
+ const supportedVersions = {
60
+ pc: require('../../data/pc/common/versions.json'),
61
+ bedrock: require('../../data/bedrock/common/versions.json')
62
+ }
63
+
64
+ async function updateManifestPC () {
65
+ const manifest = await fetch(pcManifestURL).then(res => res.json())
66
+ // fs.writeFileSync('./manifest.json', JSON.stringify(manifest, null, 2))
67
+ const knownVersions = protocolVersions.pc.reduce((acc, cur) => (acc[cur.minecraftVersion] = cur, acc), {})
68
+ const latestRelease = manifest.latest.release
69
+
70
+ const title = `Support Minecraft PC ${latestRelease}`
71
+ const issueStatus = await helper.getIssueStatus(title)
72
+
73
+ if (supportedVersions.pc.includes(latestRelease)) {
74
+ if (issueStatus.open) {
75
+ helper.close(issueStatus.id, `Closing as PC ${latestRelease} is now supported`)
76
+ }
77
+ console.log('Latest PC version is supported.')
78
+ return
79
+ } else if (knownVersions[latestRelease]) {
80
+ console.log(`Latest PC version ${latestRelease} is known in protocolVersions.json, but not in versions.json (protocol version ${knownVersions[latestRelease].version})`)
81
+ return
82
+ } else {
83
+ console.log(`Latest PC version ${latestRelease} is not known in protocolVersions.json, adding and making issue`)
84
+ }
85
+ const latestReleaseData = manifest.versions.find(v => v.id === latestRelease)
86
+
87
+ // Note: We don't use the below check to track if the version is supported properly or not
88
+ // (data like protocol/blocks/items/etc is present), just to make sure the known protocol version is correct.
89
+ try {
90
+ const latestReleaseManifest = await fetch(latestReleaseData.url).then(res => res.json())
91
+ // Download client jar
92
+ if (!fs.existsSync(`./${latestRelease}.jar`)) {
93
+ const clientJarUrl = latestReleaseManifest.downloads.client.url
94
+ console.log('Downloading client jar', clientJarUrl)
95
+ download(clientJarUrl, `./${latestRelease}.jar`)
96
+ }
97
+
98
+ // Log the byte size of the client jar
99
+ const clientJarSize = fs.statSync(`./${latestRelease}.jar`).size
100
+ console.log(`Downloaded client jar ${latestRelease}.jar (${clientJarSize} bytes), extracting its version.json...`)
101
+
102
+ // unzip with tar / unzip, Actions image uses 7z
103
+ if (process.platform === 'win32') cp.execSync(`tar -xf ./${latestRelease}.jar version.json`)
104
+ else cp.execSync(`7z -y e ./${latestRelease}.jar version.json`, { stdio: 'inherit' })
105
+ const versionJson = require('./version.json')
106
+
107
+ let majorVersion
108
+ try {
109
+ majorVersion = versionJson.id.split('.', 2).join('.')
110
+ } catch (e) {
111
+ console.error('Failed to get major version from version.json.id', versionJson.id, ', falling back to protocolVersions.json latest (may be incorrect)')
112
+ majorVersion = protocolVersions.pc[0].majorVersion
113
+ }
114
+
115
+ const newEntry = {
116
+ minecraftVersion: versionJson.id,
117
+ version: versionJson.protocol_version,
118
+ dataVersion: versionJson.world_version,
119
+ usesNetty: true,
120
+ majorVersion,
121
+ releaseType: latestReleaseData.type
122
+ }
123
+ console.log('Adding new entry to pc protocolVersions.json', newEntry)
124
+ const updatedProtocolVersions = [newEntry, ...protocolVersions.pc]
125
+ fs.writeFileSync('../../data/pc/common/protocolVersions.json', JSON.stringify(updatedProtocolVersions, null, 2))
126
+
127
+ if (process.env.CI) {
128
+ console.log('Committing changes to protocolVersions.json')
129
+ // https://github.com/actions/checkout/pull/1184
130
+ cp.execSync('git config user.name "github-actions[bot]"')
131
+ cp.execSync('git config user.email "41898282+github-actions[bot]@users.noreply.github.com"')
132
+ cp.execSync('git add ../../data/pc/common/protocolVersions.json')
133
+ cp.execSync(`git commit -m "Add ${versionJson.id} to pc protocolVersions.json"`)
134
+ cp.execSync('git push')
135
+ }
136
+
137
+ if (!issueStatus.open && !issueStatus.closed) {
138
+ console.log('Opening issue', versionJson)
139
+ const issuePayload = buildFirstIssue(title, latestReleaseData, versionJson)
140
+
141
+ helper.createIssue(issuePayload)
142
+
143
+ fs.writeFileSync('./issue.md', issuePayload.body)
144
+ console.log('OK, wrote to ./issue.md', issuePayload)
145
+ }
146
+ } catch (e) {
147
+ console.error(e)
148
+
149
+ console.log('Latest PC version is not supported and we failed to load data. Opening issue...')
150
+ const issuePayload = buildFirstIssue(title, latestReleaseData)
151
+ helper.createIssue(issuePayload)
152
+
153
+ fs.writeFileSync('./issue.md', issuePayload.body)
154
+ console.log('OK, wrote to ./issue.md', issuePayload)
155
+ }
156
+ }
157
+
158
+ updateManifestPC()
@@ -10,10 +10,10 @@ jobs:
10
10
  with:
11
11
  fetch-depth: 0
12
12
  ref: web
13
- - name: Use Node.js 14.x
13
+ - name: Use Node.js 18.x
14
14
  uses: actions/setup-node@v1
15
15
  with:
16
- node-version: 14.x
16
+ node-version: 18.x
17
17
  - name: Run tool
18
18
  run: |
19
19
  npm install
@@ -0,0 +1,25 @@
1
+ name: Update Helper
2
+ on:
3
+ workflow_dispatch:
4
+ schedule:
5
+ - cron: "0 */2 * * *"
6
+
7
+ jobs:
8
+ helper:
9
+ name: update-checker
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout repository
13
+ uses: actions/checkout@master
14
+ - name: Set up Node.js
15
+ uses: actions/setup-node@master
16
+ with:
17
+ node-version: 16.0.0
18
+ - name: Install Github Actions toolkit
19
+ run: npm i @actions/github
20
+ working-directory: .github/helper-bot
21
+ # The env vars contain the relevant trigger information, so we don't need to pass it
22
+ - name: Runs helper
23
+ run: cd .github/helper-bot && node index.js
24
+ env:
25
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -9,9 +9,10 @@ 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)
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)
13
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, 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
14
14
 
15
+
15
16
  ## Wrappers
16
17
 
17
18
  Minecraft-data is language independent, you can use it with these language specific modules :
@@ -1176,6 +1176,30 @@
1176
1176
  "loginPacket": "pc/1.19.2",
1177
1177
  "tints": "pc/1.19.3",
1178
1178
  "mapIcons": "pc/1.16"
1179
+ },
1180
+ "1.19.4": {
1181
+ "attributes": "pc/1.17",
1182
+ "blocks": "pc/1.19.4",
1183
+ "blockCollisionShapes": "pc/1.19.4",
1184
+ "biomes": "pc/1.19.4",
1185
+ "effects": "pc/1.19.4",
1186
+ "items": "pc/1.19.4",
1187
+ "enchantments": "pc/1.19.4",
1188
+ "recipes": "pc/1.19.4",
1189
+ "instruments": "pc/1.19.4",
1190
+ "materials": "pc/1.19.4",
1191
+ "language": "pc/1.19.4",
1192
+ "entities": "pc/1.19.4",
1193
+ "protocol": "pc/1.19.4",
1194
+ "windows": "pc/1.16.1",
1195
+ "version": "pc/1.19.4",
1196
+ "foods": "pc/1.19.4",
1197
+ "particles": "pc/1.19.4",
1198
+ "blockLoot": "pc/1.19",
1199
+ "entityLoot": "pc/1.19",
1200
+ "loginPacket": "pc/1.19.2",
1201
+ "tints": "pc/1.19.4",
1202
+ "mapIcons": "pc/1.16"
1179
1203
  }
1180
1204
  },
1181
1205
  "bedrock": {
@@ -6277,7 +6277,7 @@
6277
6277
  }
6278
6278
  ]
6279
6279
  ],
6280
- "packet_session": [
6280
+ "packet_chat_session_update": [
6281
6281
  "container",
6282
6282
  [
6283
6283
  {
@@ -6350,7 +6350,7 @@
6350
6350
  "0x1d": "entity_action",
6351
6351
  "0x1e": "steer_vehicle",
6352
6352
  "0x1f": "pong",
6353
- "0x20": "session",
6353
+ "0x20": "chat_session_update",
6354
6354
  "0x21": "recipe_book",
6355
6355
  "0x22": "displayed_recipe",
6356
6356
  "0x23": "name_item",
@@ -6412,7 +6412,7 @@
6412
6412
  "entity_action": "packet_entity_action",
6413
6413
  "steer_vehicle": "packet_steer_vehicle",
6414
6414
  "pong": "packet_pong",
6415
- "session": "packet_session",
6415
+ "chat_session_update": "packet_chat_session_update",
6416
6416
  "recipe_book": "packet_recipe_book",
6417
6417
  "displayed_recipe": "packet_displayed_recipe",
6418
6418
  "name_item": "packet_name_item",