Minecraft-Console-Client icon indicating copy to clipboard operation
Minecraft-Console-Client copied to clipboard

Logs in to server and gets logged out due to can't process JoinGame packet correctly

Open BurkenDev opened this issue 1 year ago • 4 comments

Prerequisites

  • [X] I made sure I am running the latest development build
  • [X] I tried to look for similar issues before opening a new one
  • [X] I have set debugmessages=true in config to diagnose my issue
  • [X] I have redacted session tokens and passwords before attaching screenshots

Minecraft Version

1.20.6 / 1.20.4 / 1.21

Console Client Version

Latest

Expected Behavior

Logged in correctly

Actual Behavior

Logging in, you see the new character enter the game, 0.5 seconds later quits with this message:

Unhandled exception. System.IO.InvalidDataException: Failed to process incoming packet of type JoinGame. (PacketID: 40, Protocol: 763, LoginPhase: False, InnerException: System.Collections.Generic.KeyNotFoundException). ---> System.Collections.Generic.KeyNotFoundException: The given key 'minecraft:chat_type' was not present in the dictionary. at System.Collections.Generic.Dictionary2.get_Item(TKey key) at MinecraftClient.Protocol.Message.ChatParser.ReadChatType(Dictionary2 registryCodec) at MinecraftClient.Protocol.Handlers.Protocol18Handler.HandlePlayPackets(Int32 packetId, Queue1 packetData) at MinecraftClient.Protocol.Handlers.Protocol18Handler.HandlePacket(Int32 packetId, Queue1 packetData) --- End of inner exception stack trace --- at MinecraftClient.Protocol.Handlers.Protocol18Handler.HandlePacket(Int32 packetId, Queue`1 packetData) at MinecraftClient.Protocol.Handlers.Protocol18Handler.Updater(Object o) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) Aborted

Steps to Reproduce the bug

  1. login to a server using the client

Attach screenshot here (If applicable)

No response

Anythings that could help diagnosing the bug

No response

Device

Other

Operating System

Linux

Server Address (If applicable)

No response

BurkenDev avatar Jun 23 '24 13:06 BurkenDev

1.20.4+ is not fully supported yet. There has been some work in progress but no ETA as of the moment since there are major changes and additions to the minecraft protocol.

breadbyte avatar Jun 23 '24 13:06 breadbyte

1.20.4+ is not fully supported yet. There has been some work in progress but no ETA as of the moment since there are major changes and additions to the minecraft protocol.

1.20.4 is supported, 1.20.6 is not yet supported.

@BurkenDev This is a problem with the server using a chat plugin that modifies the chat and sends a different non-vanilla chat structure and format, thus the MCC crashes because it only processes a vanilla packets.

If it's your server, get rid of the chat plugins, if it's not you'll have to download the code of the client, change a method and re-compile it. In ChatParser.cs, replace the ParseText method with the following code:

public static string ParseText(string json, List<string>? links = null)
{
  var isJson = false;
            
  try
  {
    isJson = JsonDocument.Parse(json) != null;
  }
  catch
  {
    isJson = false;
  }

  return !isJson ? json : JSONData2String(Json.ParseJson(json), "", links);
}

Follow the instructions on how to build/compile the project from the source code here: https://mccteam.github.io/guide/installation.html#building-from-the-source-code

milutinke avatar Jun 24 '24 08:06 milutinke

I don't consider this as a bug, because it's not vanilla behavior and I only heard of 2 people having this issue. I'll add the "fix" to MCC with the 1.20.6 + 1.21 update

milutinke avatar Jun 24 '24 08:06 milutinke

same question in wynncraft server

Yiniau avatar Jul 18 '24 15:07 Yiniau