Integrate Forge support with auto-versioning support

This commit is contained in:
deathcap 2016-02-02 22:17:37 -08:00
parent 4468707268
commit 9e9a5cb3d8
2 changed files with 6 additions and 7 deletions

View File

@ -3,6 +3,7 @@ const debug = require('../debug');
const states = require('../states');
const assert = require('assert');
const minecraft_data = require('minecraft-data');
const forgeHandshake = require('./forgeHandshake');
module.exports = function(client, options) {
client.wait_connect = true; // don't let src/client/setProtocol proceed on socket 'connect' until 'connect_allowed'
@ -40,10 +41,8 @@ module.exports = function(client, options) {
// 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');
options.forgeMods = forgeMods;
forgeHandshake(client, options);
}
// Finished configuring client object, let connection proceed
client.emit('connect_allowed');

View File

@ -4,9 +4,6 @@ module.exports = function(client, options) {
client.on('connect', onConnect);
function onConnect() {
let taggedHost = options.host;
if (options.tagHost) taggedHost += options.tagHost;
if (client.wait_connect) {
client.on('connect_allowed', next);
} else {
@ -14,6 +11,9 @@ module.exports = function(client, options) {
}
function next() {
let taggedHost = options.host;
if (options.tagHost) taggedHost += options.tagHost;
client.write('set_protocol', {
protocolVersion: options.protocolVersion,
serverHost: taggedHost,