Detect and store the list of forge mods.

This commit is contained in:
Pokechu22 2015-10-23 16:54:36 -07:00
parent f67a3e3384
commit 7cc87d8e71
6 changed files with 119 additions and 21 deletions

View file

@ -8,6 +8,7 @@ using System.IO;
using System.Net;
using MinecraftClient.Protocol;
using MinecraftClient.Proxy;
using MinecraftClient.Protocol.Handlers.Forge;
namespace MinecraftClient
{
@ -54,9 +55,9 @@ namespace MinecraftClient
/// <param name="port">The server port to use</param>
/// <param name="protocolversion">Minecraft protocol version to use</param>
public McTcpClient(string username, string uuid, string sessionID, int protocolversion, string server_ip, ushort port)
public McTcpClient(string username, string uuid, string sessionID, int protocolversion, ForgeInfo forgeInfo, string server_ip, ushort port)
{
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, false, "");
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, forgeInfo, false, "");
}
/// <summary>
@ -70,9 +71,9 @@ namespace MinecraftClient
/// <param name="protocolversion">Minecraft protocol version to use</param>
/// <param name="command">The text or command to send.</param>
public McTcpClient(string username, string uuid, string sessionID, string server_ip, ushort port, int protocolversion, string command)
public McTcpClient(string username, string uuid, string sessionID, string server_ip, ushort port, int protocolversion, ForgeInfo forgeInfo, string command)
{
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, true, command);
StartClient(username, uuid, sessionID, server_ip, port, protocolversion, forgeInfo, true, command);
}
/// <summary>
@ -87,7 +88,7 @@ namespace MinecraftClient
/// <param name="singlecommand">If set to true, the client will send a single command and then disconnect from the server</param>
/// <param name="command">The text or command to send. Will only be sent if singlecommand is set to true.</param>
private void StartClient(string user, string uuid, string sessionID, string server_ip, ushort port, int protocolversion, bool singlecommand, string command)
private void StartClient(string user, string uuid, string sessionID, string server_ip, ushort port, int protocolversion, ForgeInfo forgeInfo, bool singlecommand, string command)
{
bool retry = false;
this.sessionid = sessionID;
@ -113,7 +114,7 @@ namespace MinecraftClient
{
client = ProxyHandler.newTcpClient(host, port);
client.ReceiveBufferSize = 1024 * 1024;
handler = Protocol.ProtocolHandler.getProtocolHandler(client, protocolversion, this);
handler = Protocol.ProtocolHandler.getProtocolHandler(client, protocolversion, forgeInfo, this);
Console.WriteLine("Version is supported.\nLogging in...");
try