mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 13:45:37 -04:00
Integrate Forge support with auto-versioning support
This commit is contained in:
parent
4468707268
commit
9e9a5cb3d8
@ -3,6 +3,7 @@ const debug = require('../debug');
|
|||||||
const states = require('../states');
|
const states = require('../states');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const minecraft_data = require('minecraft-data');
|
const minecraft_data = require('minecraft-data');
|
||||||
|
const forgeHandshake = require('./forgeHandshake');
|
||||||
|
|
||||||
module.exports = function(client, options) {
|
module.exports = function(client, options) {
|
||||||
client.wait_connect = true; // don't let src/client/setProtocol proceed on socket 'connect' until 'connect_allowed'
|
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
|
// Use the list of Forge mods from the server ping, so client will match server
|
||||||
const forgeMods = response.modinfo.modList;
|
const forgeMods = response.modinfo.modList;
|
||||||
debug('Using forgeMods:',forgeMods);
|
debug('Using forgeMods:',forgeMods);
|
||||||
// TODO: https://github.com/PrismarineJS/node-minecraft-protocol/issues/114
|
options.forgeMods = forgeMods;
|
||||||
// https://github.com/PrismarineJS/node-minecraft-protocol/pull/326
|
forgeHandshake(client, options);
|
||||||
// TODO: modify client object to set forgeMods and enable forgeHandshake
|
|
||||||
throw new Error('FML/Forge not yet supported');
|
|
||||||
}
|
}
|
||||||
// Finished configuring client object, let connection proceed
|
// Finished configuring client object, let connection proceed
|
||||||
client.emit('connect_allowed');
|
client.emit('connect_allowed');
|
||||||
|
@ -4,9 +4,6 @@ module.exports = function(client, options) {
|
|||||||
client.on('connect', onConnect);
|
client.on('connect', onConnect);
|
||||||
|
|
||||||
function onConnect() {
|
function onConnect() {
|
||||||
let taggedHost = options.host;
|
|
||||||
if (options.tagHost) taggedHost += options.tagHost;
|
|
||||||
|
|
||||||
if (client.wait_connect) {
|
if (client.wait_connect) {
|
||||||
client.on('connect_allowed', next);
|
client.on('connect_allowed', next);
|
||||||
} else {
|
} else {
|
||||||
@ -14,6 +11,9 @@ module.exports = function(client, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function next() {
|
function next() {
|
||||||
|
let taggedHost = options.host;
|
||||||
|
if (options.tagHost) taggedHost += options.tagHost;
|
||||||
|
|
||||||
client.write('set_protocol', {
|
client.write('set_protocol', {
|
||||||
protocolVersion: options.protocolVersion,
|
protocolVersion: options.protocolVersion,
|
||||||
serverHost: taggedHost,
|
serverHost: taggedHost,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user