From dc9768eaf533ce4d62c74792917c0f64ead7bae1 Mon Sep 17 00:00:00 2001 From: deathcap Date: Sat, 6 Feb 2016 23:52:43 -0800 Subject: [PATCH] autoVersion plugin: add hooks to allow Forge/FML to extend this plugin --- src/client/autoVersion.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/client/autoVersion.js b/src/client/autoVersion.js index 4c45abc..1beef38 100644 --- a/src/client/autoVersion.js +++ b/src/client/autoVersion.js @@ -36,15 +36,13 @@ module.exports = function(client, options) { client.version = versionInfo.majorVersion; client.state = states.HANDSHAKING; - if (response.modinfo && response.modinfo.type === 'FML') { - // Use the list of Forge mods from the server ping, so client will match server - const forgeMods = response.modinfo.modList; - debug('Using forgeMods:',forgeMods); - // TODO: https://github.com/PrismarineJS/node-minecraft-protocol/issues/114 - // https://github.com/PrismarineJS/node-minecraft-protocol/pull/326 - // TODO: modify client object to set forgeMods and enable forgeHandshake - throw new Error('FML/Forge not yet supported'); + // Let other plugins such as Forge/FML (modinfo) respond to the ping response + if (client.autoVersionHooks) { + client.autoVersionHooks.forEach((hook) => { + hook(response, client, options); + }); } + // Finished configuring client object, let connection proceed client.emit('connect_allowed'); });