fix: streamline forge translation preload

Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/3b2dd335-d070-4067-b864-5584bb94571b

Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-04 20:15:56 +00:00 committed by GitHub
parent 7ce4f82871
commit 21a52b3bcc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -314,7 +314,7 @@ namespace MinecraftClient
client.ReceiveBufferSize = 1024 * 1024;
client.ReceiveTimeout = Config.Main.Advanced.TcpTimeout * 1000; // Default: 30 seconds
handler = Protocol.ProtocolHandler.GetProtocolHandler(client, protocolversion, forgeInfo, this);
if (forgeInfo is not null)
if (forgeInfo is not null && forgeInfo.Version == FMLVersion.FML)
ChatParser.LoadForgeModTranslations(forgeInfo.Mods.Select(static mod => mod.ModID));
Log.Info(Translations.mcc_version_supported);

View file

@ -511,8 +511,7 @@ namespace MinecraftClient.Protocol.Message
foreach (string modDirectory in GetForgeModTranslationDirectories())
{
foreach (string modJarPath in Directory.EnumerateFiles(modDirectory, "*.jar")
.OrderBy(static path => path, StringComparer.OrdinalIgnoreCase))
foreach (string modJarPath in Directory.EnumerateFiles(modDirectory, "*.jar"))
{
try
{
@ -1005,7 +1004,8 @@ namespace MinecraftClient.Protocol.Message
private static string ComputeFileSha256(string filePath)
{
using FileStream stream = File.OpenRead(filePath);
return Convert.ToHexString(SHA256.HashData(stream)).ToLowerInvariant();
using SHA256 sha256 = SHA256.Create();
return Convert.ToHexString(sha256.ComputeHash(stream)).ToLowerInvariant();
}
private static bool TryLoadCachedForgeModTranslations(string cacheFilePath, string sourceHash,