File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
MinecraftClient/Protocol/Message Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,25 @@ public enum MessageType
3434 public static void ReadChatType ( Dictionary < string , object > registryCodec )
3535 {
3636 Dictionary < int , MessageType > chatTypeDictionary = ChatId2Type ?? new ( ) ;
37- var chatTypeListNbt =
38- ( object [ ] ) ( ( ( Dictionary < string , object > ) registryCodec [ "minecraft:chat_type" ] ) [ "value" ] ) ;
37+
38+ // Check if the chat type registry is in the correct format
39+ if ( ! registryCodec . ContainsKey ( "minecraft:chat_type" ) ) {
40+
41+ // If not, then we force the registry to be in the correct format
42+ if ( registryCodec . ContainsKey ( "chat_type" ) ) {
43+
44+ foreach ( var key in registryCodec . Keys . ToArray ( ) ) {
45+ // Skip entries with a namespace already
46+ if ( key . Contains ( ':' , StringComparison . OrdinalIgnoreCase ) ) continue ;
47+
48+ // Assume all other entries are in the minecraft namespace
49+ registryCodec [ "minecraft:" + key ] = registryCodec [ key ] ;
50+ registryCodec . Remove ( key ) ;
51+ }
52+ }
53+ }
54+
55+ var chatTypeListNbt = ( object [ ] ) ( ( ( Dictionary < string , object > ) registryCodec [ "minecraft:chat_type" ] ) [ "value" ] ) ;
3956 foreach ( var ( chatName , chatId ) in from Dictionary < string , object > chatTypeNbt in chatTypeListNbt
4057 let chatName = ( string ) chatTypeNbt [ "name" ]
4158 let chatId = ( int ) chatTypeNbt [ "id" ]
You can’t perform that action at this time.
0 commit comments