minecraft-data 3.22.0 → 3.23.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.
package/doc/history.md
CHANGED
|
@@ -686,5 +686,10 @@
|
|
|
686
686
|
"name": "chainedChatWithHashing",
|
|
687
687
|
"description": "Signed messages are ordered and depend on previous messages, and message payloads are hashed before generating a signature",
|
|
688
688
|
"versions": ["1.19.2", "latest"]
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
"name": "clientsideChatFormatting",
|
|
692
|
+
"description": "Chat messages are formatted on the client side",
|
|
693
|
+
"versions": ["1.19_major", "latest"]
|
|
689
694
|
}
|
|
690
695
|
]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const { join } = require('path')
|
|
3
|
+
|
|
4
|
+
const data = join(__dirname, '..', '..', 'data')
|
|
5
|
+
|
|
6
|
+
function getJSON (path) {
|
|
7
|
+
return JSON.parse(fs.readFileSync(path, 'utf-8'))
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function writeJSON (path, data) {
|
|
11
|
+
fs.writeFileSync(path, JSON.stringify(data, null, 2), 'utf-8')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function alterJSON (path, callback) {
|
|
15
|
+
const jsonContents = getJSON(path)
|
|
16
|
+
if (callback(jsonContents) !== false) {
|
|
17
|
+
writeJSON(path, jsonContents)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function pcProtocol (version, protocol) {
|
|
22
|
+
throw new Error('Not Implemented')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function bedrockProtocol (version, protocol) {
|
|
26
|
+
const dataRoot = join(data, 'bedrock')
|
|
27
|
+
if (fs.existsSync(join(data, 'bedrock', version))) {
|
|
28
|
+
console.log(`data/bedrock/${version} already exists`)
|
|
29
|
+
process.exit(1)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const protocolVersion = {
|
|
33
|
+
version: parseInt(protocol),
|
|
34
|
+
minecraftVersion: version,
|
|
35
|
+
majorVersion: version.split('.').slice(0, 2).join('.'),
|
|
36
|
+
releaseType: 'release'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
alterJSON(join(data, 'dataPaths.json'), dataPaths => {
|
|
40
|
+
let latest = null
|
|
41
|
+
const paths = dataPaths.bedrock
|
|
42
|
+
Object.entries(paths).forEach(([ver, values]) => {
|
|
43
|
+
if (values.proto === 'bedrock/latest') {
|
|
44
|
+
latest = ver
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
if (latest === null) {
|
|
49
|
+
console.log('Unable to determine previous version.')
|
|
50
|
+
process.exit(1)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
paths[version] = Object.assign({}, paths[latest])
|
|
54
|
+
paths[version].version = `bedrock/${version}`
|
|
55
|
+
paths[version].protocol = `bedrock/${version}`
|
|
56
|
+
paths[latest].proto = `bedrock/${latest}`
|
|
57
|
+
paths[latest].types = `bedrock/${latest}`
|
|
58
|
+
fs.copyFileSync(
|
|
59
|
+
join(dataRoot, 'latest', 'proto.yml'),
|
|
60
|
+
join(dataRoot, latest, 'proto.yml'))
|
|
61
|
+
fs.copyFileSync(
|
|
62
|
+
join(dataRoot, 'latest', 'types.yml'),
|
|
63
|
+
join(dataRoot, latest, 'types.yml'))
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
alterJSON(join(dataRoot, 'common', 'protocolVersions.json'), protoVers => {
|
|
67
|
+
protoVers.unshift(protocolVersion)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
alterJSON(join(dataRoot, 'common', 'versions.json'), versions => {
|
|
71
|
+
versions.push(version)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
fs.mkdirSync(join(dataRoot, version))
|
|
75
|
+
writeJSON(join(dataRoot, version, 'version.json'), protocolVersion)
|
|
76
|
+
|
|
77
|
+
const protoYml = fs.readFileSync(join(dataRoot, 'latest', 'proto.yml'), 'utf-8')
|
|
78
|
+
const protoYmlUpdate = protoYml.replace(/!version: [0-9.]+/, `!version: ${version}`)
|
|
79
|
+
fs.writeFileSync(join(dataRoot, 'latest', 'proto.yml'), protoYmlUpdate, 'utf-8')
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const platforms = {
|
|
83
|
+
bedrock: bedrockProtocol,
|
|
84
|
+
pc: pcProtocol
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (process.argv.length !== 5) {
|
|
88
|
+
console.log(`Usage: npm run version <${Object.keys(platforms).join('|')}> {version} {protocol_version}`)
|
|
89
|
+
process.exit(1)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const [,, platform, version, protocol] = process.argv
|
|
93
|
+
|
|
94
|
+
if (platforms[platform] === undefined) {
|
|
95
|
+
console.log(`Received platform "${platform}", expected one of (${Object.keys(platforms).join(', ')})`)
|
|
96
|
+
process.exit(1)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
platforms[platform](version, protocol)
|