From 70f1883a0c44a7b73c024939a1d7dc8162f57158 Mon Sep 17 00:00:00 2001 From: deathcap Date: Sun, 31 Jan 2016 11:17:35 -0800 Subject: [PATCH] Set tagHost in src/client/forgeHandshake.js --- examples/client_forge/client_forge.js | 4 +--- src/client/forgeHandshake.js | 2 ++ src/createClient.js | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/client_forge/client_forge.js b/examples/client_forge/client_forge.js index 43bb28b..79cd54c 100644 --- a/examples/client_forge/client_forge.js +++ b/examples/client_forge/client_forge.js @@ -1,5 +1,4 @@ var mc = require('minecraft-protocol'); -var forgeHandshake = require('../../dist/client/forgeHandshake'); // TODO: what's with 'dist' here? if(process.argv.length < 4 || process.argv.length > 6) { console.log("Usage : node echo.js [] []"); @@ -25,13 +24,12 @@ mc.ping({host, port}, function(err, response) { console.log('Using forgeMods:',forgeMods); var client = mc.createClient({ - tagHost: '\0FML\0', // passed to src/client/setProtocol.js, signifies client supports FML/Forge TODO: refactor into src/client/forgeHandshake.js, let it set it, but earliest enough(pause) + forgeMods: forgeMods, host: host, port: port, username: username, password: password }); - forgeHandshake(client, {forgeMods}); client.on('connect', function() { console.info('connected'); diff --git a/src/client/forgeHandshake.js b/src/client/forgeHandshake.js index 5767a1c..fafc0b5 100644 --- a/src/client/forgeHandshake.js +++ b/src/client/forgeHandshake.js @@ -264,6 +264,8 @@ function fmlHandshakeStep(client, data, options) } module.exports = function(client, options) { + options.tagHost = '\0FML\0'; // passed to src/client/setProtocol.js, signifies client supports FML/Forge + client.on('custom_payload', function(packet) { // TODO: channel registration tracking in NMP, https://github.com/PrismarineJS/node-minecraft-protocol/pull/328 if (packet.channel === 'FML|HS') { diff --git a/src/createClient.js b/src/createClient.js index 40a3d13..bdce948 100644 --- a/src/createClient.js +++ b/src/createClient.js @@ -8,6 +8,7 @@ var caseCorrect = require('./client/caseCorrect'); var setProtocol = require('./client/setProtocol'); var play = require('./client/play'); var tcp_dns = require('./client/tcp_dns'); +var forgeHandshake = require('./client/forgeHandshake'); module.exports=createClient; @@ -24,6 +25,7 @@ function createClient(options) { var client = new Client(false, options.majorVersion); tcp_dns(client, options); + if (options.forgeMods) forgeHandshake(client, options); setProtocol(client, options); keepalive(client, options); encrypt(client, options);