mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-12-04 21:11:04 -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) {
|
function fmlHandshakeStep(client, data)
|
||||||
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') {
|
|
||||||
var parsed = proto.parsePacketBuffer('FML|HS', data);
|
var parsed = proto.parsePacketBuffer('FML|HS', data);
|
||||||
console.log('FML|HS',parsed);
|
console.log('FML|HS',parsed);
|
||||||
|
|
||||||
|
|
||||||
if (parsed.data.discriminator === 'ServerHello') {
|
if (parsed.data.discriminator === 'ServerHello') {
|
||||||
if (parsed.data.fmlProtocolVersion > 2) {
|
if (parsed.data.fmlProtocolVersion > 2) {
|
||||||
// TODO: support higher protocols, if they change
|
// TODO: support higher protocols, if they change
|
||||||
|
@ -263,5 +254,18 @@ client.on('custom_payload', function(packet) {
|
||||||
console.log('HandshakeAck Complete!');
|
console.log('HandshakeAck Complete!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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