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() {