Start work for 1.21.90 (#616)
* 1.21.90 * update * remove 1.21.90 in ci
This commit is contained in:
parent
29ba39343a
commit
e503c47c79
4 changed files with 28 additions and 11 deletions
|
|
@ -62,7 +62,8 @@ class Client extends Connection {
|
|||
const mcData = require('minecraft-data')('bedrock_' + this.options.version)
|
||||
this.features = {
|
||||
compressorInHeader: mcData.supportFeature('compressorInPacketHeader'),
|
||||
itemRegistryPacket: mcData.supportFeature('itemRegistryPacket')
|
||||
itemRegistryPacket: mcData.supportFeature('itemRegistryPacket'),
|
||||
newLoginIdentityFields: mcData.supportFeature('newLoginIdentityFields')
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(`Unsupported version: '${this.options.version}', no data available`)
|
||||
|
|
@ -146,9 +147,18 @@ class Client extends Connection {
|
|||
...this.accessToken // Mojang + Xbox JWT from auth
|
||||
]
|
||||
|
||||
const encodedChain = JSON.stringify({ chain })
|
||||
|
||||
debug('Auth chain', chain)
|
||||
let encodedChain
|
||||
if (this.features.newLoginIdentityFields) { // 1.21.90+
|
||||
encodedChain = JSON.stringify({
|
||||
Certificate: JSON.stringify({ chain }),
|
||||
// 0 = normal, 1 = ss, 2 = offline
|
||||
AuthenticationType: this.options.offline ? 2 : 0,
|
||||
Token: ''
|
||||
})
|
||||
} else {
|
||||
encodedChain = JSON.stringify({ chain })
|
||||
}
|
||||
debug('Auth chain', encodedChain)
|
||||
|
||||
this.write('login', {
|
||||
protocol_version: this.options.protocolVersion,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ class Server extends EventEmitter {
|
|||
try {
|
||||
const mcData = require('minecraft-data')('bedrock_' + version)
|
||||
this.features = {
|
||||
compressorInHeader: mcData.supportFeature('compressorInPacketHeader')
|
||||
compressorInHeader: mcData.supportFeature('compressorInPacketHeader'),
|
||||
newLoginIdentityFields: mcData.supportFeature('newLoginIdentityFields')
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(`Unsupported version: '${version}', no data available`)
|
||||
|
|
|
|||
|
|
@ -78,11 +78,18 @@ class Player extends Connection {
|
|||
|
||||
// Parse login data
|
||||
const tokens = body.params.tokens
|
||||
const authChain = JSON.parse(tokens.identity)
|
||||
const skinChain = tokens.client
|
||||
|
||||
try {
|
||||
var { key, userData, skinData } = this.decodeLoginJWT(authChain.chain, skinChain) // eslint-disable-line
|
||||
const skinChain = tokens.client
|
||||
const authChain = JSON.parse(tokens.identity)
|
||||
let chain
|
||||
if (authChain.Certificate) { // 1.21.90+
|
||||
chain = JSON.parse(authChain.Certificate).chain
|
||||
} else if (authChain.chain) {
|
||||
chain = authChain.chain
|
||||
} else {
|
||||
throw new Error('Invalid login packet: missing chain or Certificate')
|
||||
}
|
||||
var { key, userData, skinData } = this.decodeLoginJWT(chain, skinChain) // eslint-disable-line
|
||||
} catch (e) {
|
||||
debug(this.address, e)
|
||||
this.disconnect('Server authentication error')
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ function createProtocol (version) {
|
|||
const compiler = new ProtoDefCompiler()
|
||||
const protocol = mcData('bedrock_' + version).protocol.types
|
||||
compiler.addTypes(require('../src/datatypes/compiler-minecraft'))
|
||||
compiler.addTypes(require('prismarine-nbt/zigzag').compiler)
|
||||
compiler.addTypesToCompile(protocol)
|
||||
|
||||
fs.writeFileSync('./read.js', 'module.exports = ' + compiler.readCompiler.generate().replace('() =>', 'native =>'))
|
||||
|
|
@ -39,7 +38,7 @@ require('minecraft-data/bin/generate_data')
|
|||
|
||||
// If no argument, build everything
|
||||
if (!process.argv[2]) {
|
||||
convert('latest')
|
||||
convert('bedrock', 'latest')
|
||||
for (const version of versions) {
|
||||
main(version)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue