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>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-04 12:47:41 +00:00 committed by GitHub
parent b87b5abbe2
commit b543825200
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View file

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

View file

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