Jump to content

onConnectionClosed patched into NetClientHandler.handleChat() ?


Recommended Posts



I have written a mod for Minecraft using the Forge API which worked with Forge 6.4.0, but not with 6.4.2.

The problem is that the onConnectionClosed event of my IConnectionHandler implementation is not called when the client disconnects in 6.4.2.


Looking at NetClientHandler.java:

    public void handleChat(Packet3Chat par1Packet3Chat)
        FMLNetworkHandler.onConnectionClosed(this.netManager, this.getPlayer());
        ClientChatReceivedEvent event = new ClientChatReceivedEvent(par1Packet3Chat.message);
        if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null)


It appears that the onConnectionClosed hook has been patched into the handleChat method.


Looking at the 'fml\patches\minecraft\net\minecraft\client\multiplayer\NetClientHandler.java.patch' file included with the Forge

@@ -754,6 +762,7 @@

     public void func_72481_a(Packet3Chat p_72481_1_)
+        FMLNetworkHandler.onConnectionClosed(this.field_72555_g, this.getPlayer());


I may be mistaken, but I think onConnectionClosed is being patched into the wrong method.


Also, I did check the latest version and onConnectionClosed is still in handleChat.





My mod works correctly with Forge In that version the onConnectionClosed hook is in NetClientHandler.quitWithPacket() rather than NetClientHandler.handleChat().



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.