From 06f8a5fe2820892572abf608dacc407040b6d0ea Mon Sep 17 00:00:00 2001 From: deathcap Date: Sat, 23 Jan 2016 15:31:33 -0800 Subject: [PATCH] Send client HandshakeAck with WAITINGSERVERDATA --- examples/client_forge/client_forge.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/client_forge/client_forge.js b/examples/client_forge/client_forge.js index f77a3dd..fc86384 100644 --- a/examples/client_forge/client_forge.js +++ b/examples/client_forge/client_forge.js @@ -134,6 +134,21 @@ proto.addType('FML|HS', // TODO: mods array: modname string, modversion string ], }, + + // HandshakeAck + { + "name": "phase", + "type": [ + "switch", + { + "compareTo": "discriminator", + "fields": { + "-1": "byte" + }, + "default": "void" + }, + ], + }, ] ] ); @@ -186,6 +201,16 @@ client.on('custom_payload', function(packet) { }); } else if (parsed.data.discriminator === 2) { // ModList console.log('Server ModList:',parsed.data.mods); + // TODO: client/server check if mods compatible + + var ackWaitingServerData = proto.createPacketBuffer('FML|HS', { + discriminator: -1, // HandshakeAck, + phase: 2 // WAITINGSERVERDATA + }); + client.write('custom_payload', { + channel: 'FML|HS', + data: ackWaitingServerData + }); } } });