Add forgeMods option, set to array of Forge modifications installed on client

This commit is contained in:
deathcap 2016-01-23 18:17:18 -08:00
parent 1349fdfc73
commit 0b2550e206
2 changed files with 9 additions and 6 deletions

View file

@ -8,6 +8,12 @@ if(process.argv.length < 4 || process.argv.length > 6) {
var client = mc.createClient({ var client = mc.createClient({
forge: true, forge: true,
// Client/server mods installed on the client
// TODO: send from ServerListPing packet
forgeMods:
[
{modid:'IronChest', version:'6.0.121.768'}
],
host: process.argv[2], host: process.argv[2],
port: parseInt(process.argv[3]), port: parseInt(process.argv[3]),
username: process.argv[4] ? process.argv[4] : "echo", username: process.argv[4] ? process.argv[4] : "echo",
@ -58,7 +64,6 @@ proto.addType('fml|hsMapper',
] ]
); );
// TODO: refactor to use one big switch like https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/transforms/serializer.js#L21
proto.addType('FML|HS', proto.addType('FML|HS',
[ [
"container", "container",
@ -232,11 +237,7 @@ client.on('custom_payload', function(packet) {
console.log('Sending client modlist'); console.log('Sending client modlist');
var modList = proto.createPacketBuffer('FML|HS', { var modList = proto.createPacketBuffer('FML|HS', {
discriminator: 'ModList', discriminator: 'ModList',
//mods: [] mods: client.forgeMods || []
// TODO: send from ServerListPing packet, allow customizing not hardcoding
mods: [
{modid:'IronChest', version:'6.0.121.768'}
]
}); });
client.write('custom_payload', { client.write('custom_payload', {
channel: 'FML|HS', channel: 'FML|HS',

View file

@ -45,6 +45,8 @@ function createClient(options) {
var client = new Client(false,version.majorVersion); var client = new Client(false,version.majorVersion);
client.forge = options.forge;
client.forgeMods = options.forgeMods;
client.on('connect', onConnect); client.on('connect', onConnect);
if(keepAlive) client.on('keep_alive', onKeepAlive); if(keepAlive) client.on('keep_alive', onKeepAlive);
client.once('encryption_begin', onEncryptionKeyRequest); client.once('encryption_begin', onEncryptionKeyRequest);