mapwriter Posted December 20, 2012 Posted December 20, 2012 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 Quote
LexManos Posted December 20, 2012 Posted December 20, 2012 Fixed Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
Recommended Posts
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.