mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-12-04 13:01:14 -05:00
Move to fmlHandshakeStep()
This commit is contained in:
parent
0b2550e206
commit
8fd30f6af9
1 changed files with 57 additions and 53 deletions
|
@ -200,20 +200,11 @@ function writeAck(client, phase) {
|
|||
});
|
||||
}
|
||||
|
||||
client.on('custom_payload', function(packet) {
|
||||
var channel = packet.channel;
|
||||
var data = packet.data;
|
||||
|
||||
if (channel === 'REGISTER') {
|
||||
var channels = data.toString().split('\0');
|
||||
console.log('Server-side registered channels:',channels);
|
||||
// TODO: do something?
|
||||
// expect: [ 'FML|HS', 'FML', 'FML|MP', 'FML', 'FORGE' ]
|
||||
} else if (channel === 'FML|HS') {
|
||||
function fmlHandshakeStep(client, data)
|
||||
{
|
||||
var parsed = proto.parsePacketBuffer('FML|HS', data);
|
||||
console.log('FML|HS',parsed);
|
||||
|
||||
|
||||
if (parsed.data.discriminator === 'ServerHello') {
|
||||
if (parsed.data.fmlProtocolVersion > 2) {
|
||||
// TODO: support higher protocols, if they change
|
||||
|
@ -264,4 +255,17 @@ client.on('custom_payload', function(packet) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
client.on('custom_payload', function(packet) {
|
||||
var channel = packet.channel;
|
||||
var data = packet.data;
|
||||
|
||||
if (channel === 'REGISTER') {
|
||||
var channels = data.toString().split('\0');
|
||||
console.log('Server-side registered channels:',channels);
|
||||
// TODO: do something?
|
||||
// expect: [ 'FML|HS', 'FML', 'FML|MP', 'FML', 'FORGE' ]
|
||||
} else if (channel === 'FML|HS') {
|
||||
fmlHandshakeStep(client, data);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue