Jump to content

onConnectionClosed patched into NetClientHandler.handleChat() ?


Recommended Posts

Posted

Hello,

 

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)
        {
            this.mc.ingameGUI.getChatGUI().printChatMessage(par1Packet3Chat.message);
        }
    }

 

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 6.4.2.445:

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

     public void func_72481_a(Packet3Chat p_72481_1_)
     {
+        FMLNetworkHandler.onConnectionClosed(this.field_72555_g, this.getPlayer());
         this.field_72563_h.field_71456_v.func_73827_b().func_73765_a(p_72481_1_.field_73476_b);
     }

 

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

 

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

 

 

Edit:

 

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

 

Regards

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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