mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Allow force-enabling Forge support for 1.13+ (#1184)
Skip login step and join even when forge info is missing in server info. However, this only works for 1.13+. Server info retrieval is required for enabling Forge support on older Minecraft versions.
This commit is contained in:
parent
9df255dd29
commit
d3f150ba12
7 changed files with 101 additions and 7 deletions
|
|
@ -124,7 +124,7 @@ namespace MinecraftClient
|
||||||
//Test line to troubleshoot invisible colors
|
//Test line to troubleshoot invisible colors
|
||||||
if (Settings.DebugMessages)
|
if (Settings.DebugMessages)
|
||||||
{
|
{
|
||||||
Translations.WriteLineFormatted(Translations.Get("debug.color_test", "[0123456789ABCDEF]: [§00§11§22§33§44§55§66§77§88§99§aA§bB§cC§dD§eE§fF§r]"));
|
ConsoleIO.WriteLineFormatted(Translations.Get("debug.color_test", "[0123456789ABCDEF]: [§00§11§22§33§44§55§66§77§88§99§aA§bB§cC§dD§eE§fF§r]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load cached sessions from disk if necessary
|
//Load cached sessions from disk if necessary
|
||||||
|
|
@ -254,7 +254,8 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (protocolversion == 0 || Settings.ServerMayHaveForge)
|
//Retrieve server info if version is not manually set OR if need to retrieve Forge information
|
||||||
|
if (protocolversion == 0 || Settings.ServerAutodetectForge || (Settings.ServerForceForge && !ProtocolHandler.ProtocolMayForceForge(protocolversion)))
|
||||||
{
|
{
|
||||||
if (protocolversion != 0)
|
if (protocolversion != 0)
|
||||||
Translations.WriteLine("mcc.forge");
|
Translations.WriteLine("mcc.forge");
|
||||||
|
|
@ -266,6 +267,22 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Force-enable Forge support?
|
||||||
|
if (Settings.ServerForceForge && forgeInfo == null)
|
||||||
|
{
|
||||||
|
if (ProtocolHandler.ProtocolMayForceForge(protocolversion))
|
||||||
|
{
|
||||||
|
Translations.WriteLine("mcc.forgeforce");
|
||||||
|
forgeInfo = ProtocolHandler.ProtocolForceForge(protocolversion);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HandleFailure(Translations.Get("error.forgeforce"), true, ChatBots.AutoRelog.DisconnectReason.ConnectionLost);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Proceed to server login
|
||||||
if (protocolversion != 0)
|
if (protocolversion != 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,24 @@ namespace MinecraftClient.Protocol.Handlers.Forge
|
||||||
public List<ForgeMod> Mods;
|
public List<ForgeMod> Mods;
|
||||||
internal FMLVersion Version;
|
internal FMLVersion Version;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new ForgeInfo with the given version.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="fmlVersion">FML version to use</param>
|
||||||
|
internal ForgeInfo(FMLVersion fmlVersion)
|
||||||
|
{
|
||||||
|
switch (fmlVersion)
|
||||||
|
{
|
||||||
|
case FMLVersion.FML2:
|
||||||
|
this.Mods = new List<ForgeMod>();
|
||||||
|
this.Mods.Add(new ForgeMod("forge", "ANY"));
|
||||||
|
this.Version = fmlVersion;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new InvalidOperationException(Translations.Get("error.forgeforce"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new ForgeInfo from the given data.
|
/// Create a new ForgeInfo from the given data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -446,6 +446,30 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
|| ServerInfoCheckForgeSub(jsonData, ref forgeInfo, FMLVersion.FML2); // MC 1.13 and greater
|
|| ServerInfoCheckForgeSub(jsonData, ref forgeInfo, FMLVersion.FML2); // MC 1.13 and greater
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Server Info: Check if we can force-enable Forge support for this Minecraft version without using server Ping
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="protocolVersion">Minecraft protocol version</param>
|
||||||
|
/// <returns>TRUE if we can force-enable Forge support without using server Ping</returns>
|
||||||
|
public static bool ServerMayForceForge(int protocolVersion)
|
||||||
|
{
|
||||||
|
return protocolVersion >= ProtocolHandler.MCVer2ProtocolVersion("1.13");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Server Info: Consider Forge to be enabled regardless of server Ping
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="protocolVersion">Minecraft protocol version</param>
|
||||||
|
/// <returns>ForgeInfo item stating that Forge is enabled</returns>
|
||||||
|
public static ForgeInfo ServerForceForge(int protocolVersion)
|
||||||
|
{
|
||||||
|
if (ServerMayForceForge(protocolVersion))
|
||||||
|
{
|
||||||
|
return new ForgeInfo(FMLVersion.FML2);
|
||||||
|
}
|
||||||
|
else throw new InvalidOperationException(Translations.Get("error.forgeforce"));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Server Info: Check for For Forge on a Minecraft server Ping result (Handles FML and FML2
|
/// Server Info: Check for For Forge on a Minecraft server Ping result (Handles FML and FML2
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,26 @@ namespace MinecraftClient.Protocol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if we can force-enable Forge support for a Minecraft version without using server Ping
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="protocolVersion">Minecraft protocol version</param>
|
||||||
|
/// <returns>TRUE if we can force-enable Forge support without using server Ping</returns>
|
||||||
|
public static bool ProtocolMayForceForge(int protocol)
|
||||||
|
{
|
||||||
|
return Protocol18Forge.ServerMayForceForge(protocol);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Server Info: Consider Forge to be enabled regardless of server Ping
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="protocolVersion">Minecraft protocol version</param>
|
||||||
|
/// <returns>ForgeInfo item stating that Forge is enabled</returns>
|
||||||
|
public static ForgeInfo ProtocolForceForge(int protocol)
|
||||||
|
{
|
||||||
|
return Protocol18Forge.ServerForceForge(protocol);
|
||||||
|
}
|
||||||
|
|
||||||
public enum LoginResult { OtherError, ServiceUnavailable, SSLError, Success, WrongPassword, AccountMigrated, NotPremium, LoginRequired, InvalidToken, InvalidResponse, NullError };
|
public enum LoginResult { OtherError, ServiceUnavailable, SSLError, Success, WrongPassword, AccountMigrated, NotPremium, LoginRequired, InvalidToken, InvalidResponse, NullError };
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ internalcmdchar=slash # Use 'none', 'slash' or 'backslash'
|
||||||
splitmessagedelay=2 # Seconds between each part of a long message
|
splitmessagedelay=2 # Seconds between each part of a long message
|
||||||
botowners=Player1,Player2,Player3 # Name list or myfile.txt, one name per line. !Server admins can impersonate owners!
|
botowners=Player1,Player2,Player3 # Name list or myfile.txt, one name per line. !Server admins can impersonate owners!
|
||||||
botmessagedelay=2 # Seconds to delay between message a bot makes to avoid accidental spam
|
botmessagedelay=2 # Seconds to delay between message a bot makes to avoid accidental spam
|
||||||
mcversion=auto # Use 'auto' or '1.X.X' values
|
mcversion=auto # Use 'auto' or '1.X.X' values. Allows to skip server info retrieval.
|
||||||
mcforge=auto # Use 'auto' or 'false'
|
mcforge=auto # Use 'auto', 'false' or 'true'. Force-enabling only works for MC 1.13+.
|
||||||
brandinfo=mcc # Use 'mcc','vanilla', or 'none'
|
brandinfo=mcc # Use 'mcc', 'vanilla', or 'none'. This is how MCC identifies itself to the server.
|
||||||
chatbotlogfile= # Leave empty for no logfile
|
chatbotlogfile= # Leave empty for no logfile
|
||||||
privatemsgscmdname=tell # Used by RemoteControl bot
|
privatemsgscmdname=tell # Used by RemoteControl bot
|
||||||
showsystemmessages=true # System messages for server ops
|
showsystemmessages=true # System messages for server ops
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ mcc.ip=Server IP :
|
||||||
mcc.use_version=§8Using Minecraft version {0} (protocol v{1})
|
mcc.use_version=§8Using Minecraft version {0} (protocol v{1})
|
||||||
mcc.unknown_version=§8Unknown or not supported MC version {0}.\nSwitching to autodetection mode.
|
mcc.unknown_version=§8Unknown or not supported MC version {0}.\nSwitching to autodetection mode.
|
||||||
mcc.forge=Checking if server is running Forge...
|
mcc.forge=Checking if server is running Forge...
|
||||||
|
mcc.forgeforce=Force-enabling Forge support.
|
||||||
mcc.resolve=Resolving {0}...
|
mcc.resolve=Resolving {0}...
|
||||||
mcc.found=§8Found server {0}:{1} for domain {2}
|
mcc.found=§8Found server {0}:{1} for domain {2}
|
||||||
mcc.not_found=§8Failed to perform SRV lookup for {0}\n{1}: {2}
|
mcc.not_found=§8Failed to perform SRV lookup for {0}\n{1}: {2}
|
||||||
|
|
@ -54,6 +55,7 @@ debug.request=§8Performing request to {0}
|
||||||
error.ping=Failed to ping this IP.
|
error.ping=Failed to ping this IP.
|
||||||
error.unsupported=Cannot connect to the server : This version is not supported !
|
error.unsupported=Cannot connect to the server : This version is not supported !
|
||||||
error.determine=Failed to determine server version.
|
error.determine=Failed to determine server version.
|
||||||
|
error.forgeforce=Cannot force Forge support for this Minecraft version!
|
||||||
error.login=Minecraft Login failed :
|
error.login=Minecraft Login failed :
|
||||||
error.login.migrated=Account migrated, use e-mail as username.
|
error.login.migrated=Account migrated, use e-mail as username.
|
||||||
error.login.server=Login servers are unavailable. Please try again later.
|
error.login.server=Login servers are unavailable. Please try again later.
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,8 @@ namespace MinecraftClient
|
||||||
public static string ServerIP = "";
|
public static string ServerIP = "";
|
||||||
public static ushort ServerPort = 25565;
|
public static ushort ServerPort = 25565;
|
||||||
public static string ServerVersion = "";
|
public static string ServerVersion = "";
|
||||||
public static bool ServerMayHaveForge = true;
|
public static bool ServerForceForge = false;
|
||||||
|
public static bool ServerAutodetectForge = true;
|
||||||
public static string SingleCommand = "";
|
public static string SingleCommand = "";
|
||||||
public static string ConsoleTitle = "";
|
public static string ConsoleTitle = "";
|
||||||
|
|
||||||
|
|
@ -270,7 +271,6 @@ namespace MinecraftClient
|
||||||
case "playerheadicon": playerHeadAsIcon = str2bool(argValue); break;
|
case "playerheadicon": playerHeadAsIcon = str2bool(argValue); break;
|
||||||
case "chatbotlogfile": chatbotLogFile = argValue; break;
|
case "chatbotlogfile": chatbotLogFile = argValue; break;
|
||||||
case "mcversion": ServerVersion = argValue; break;
|
case "mcversion": ServerVersion = argValue; break;
|
||||||
case "mcforge": ServerMayHaveForge = argValue.ToLower() == "auto" || str2bool(argValue); break;
|
|
||||||
case "splitmessagedelay": splitMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break;
|
case "splitmessagedelay": splitMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break;
|
||||||
case "scriptcache": CacheScripts = str2bool(argValue); break;
|
case "scriptcache": CacheScripts = str2bool(argValue); break;
|
||||||
case "showsystemmessages": DisplaySystemMessages = str2bool(argValue); break;
|
case "showsystemmessages": DisplaySystemMessages = str2bool(argValue); break;
|
||||||
|
|
@ -377,6 +377,19 @@ namespace MinecraftClient
|
||||||
ResolveSrvRecordsShortTimeout = false;
|
ResolveSrvRecordsShortTimeout = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "mcforge":
|
||||||
|
if (argValue.ToLower() == "auto")
|
||||||
|
{
|
||||||
|
ServerAutodetectForge = true;
|
||||||
|
ServerForceForge = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ServerAutodetectForge = false;
|
||||||
|
ServerForceForge = str2bool(argValue);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue