Move to fmlHandshakeStep()

This commit is contained in:
deathcap 2016-01-23 19:03:54 -08:00
parent 0b2550e206
commit 8fd30f6af9

View file

@ -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);
}
});