From b54382520000cd6820ae46cacdba76828082081e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 May 2026 12:47:41 +0000 Subject: [PATCH] chore: finalize resource pack cache toggle Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/70cfa855-cff8-495e-ac06-9a65bb5cc913 Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com> --- MinecraftClient/Protocol/Handlers/Protocol18.cs | 8 +++++++- MinecraftClient/Protocol/Message/ChatParser.cs | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index 5973178d..9f56a622 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -707,7 +707,13 @@ namespace MinecraftClient.Protocol.Handlers var hash = dataTypes.ReadNextString(packetData); // Use the server-provided UUID when available, then fall back to the legacy SHA-1 hash, // and finally the URL so pre-UUID resource packs can still be replaced or cleared locally. - string packIdentifier = uuid != Guid.Empty ? uuid.ToString("D") : (hash.Length == 40 ? hash : url); + string packIdentifier; + if (uuid != Guid.Empty) + packIdentifier = uuid.ToString("D"); + else if (hash.Length == 40) + packIdentifier = hash; + else + packIdentifier = url; if (protocolVersion >= MC_1_17_Version) { diff --git a/MinecraftClient/Protocol/Message/ChatParser.cs b/MinecraftClient/Protocol/Message/ChatParser.cs index 1c4cbda2..7920fa61 100644 --- a/MinecraftClient/Protocol/Message/ChatParser.cs +++ b/MinecraftClient/Protocol/Message/ChatParser.cs @@ -699,7 +699,11 @@ namespace MinecraftClient.Protocol.Message if (translations.Count == 0) return; - Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath)!); + string? cacheDirectory = Path.GetDirectoryName(cacheFilePath); + if (string.IsNullOrEmpty(cacheDirectory)) + return; + + Directory.CreateDirectory(cacheDirectory); ResourcePackTranslationCacheEntry cacheEntry = new() {