diff --git a/MinecraftClient/Protocol/Message/ChatParser.cs b/MinecraftClient/Protocol/Message/ChatParser.cs index 5bfd2b66..c4ef9837 100644 --- a/MinecraftClient/Protocol/Message/ChatParser.cs +++ b/MinecraftClient/Protocol/Message/ChatParser.cs @@ -34,8 +34,25 @@ namespace MinecraftClient.Protocol.Message public static void ReadChatType(Dictionary registryCodec) { Dictionary chatTypeDictionary = ChatId2Type ?? new(); - var chatTypeListNbt = - (object[])(((Dictionary)registryCodec["minecraft:chat_type"])["value"]); + + // Check if the chat type registry is in the correct format + if (!registryCodec.ContainsKey("minecraft:chat_type")) { + + // If not, then we force the registry to be in the correct format + if (registryCodec.ContainsKey("chat_type")) { + + foreach (var key in registryCodec.Keys.ToArray()) { + // Skip entries with a namespace already + if (key.Contains(':', StringComparison.OrdinalIgnoreCase)) continue; + + // Assume all other entries are in the minecraft namespace + registryCodec["minecraft:" + key] = registryCodec[key]; + registryCodec.Remove(key); + } + } + } + + var chatTypeListNbt = (object[])(((Dictionary)registryCodec["minecraft:chat_type"])["value"]); foreach (var (chatName, chatId) in from Dictionary chatTypeNbt in chatTypeListNbt let chatName = (string)chatTypeNbt["name"] let chatId = (int)chatTypeNbt["id"]