Posted April 18, 201312 yr Just a quick question: How to access an open gui on client, from a context of packet handler? What I try to achieve: Server sends a custom packet to client to update the gui screen with some data. On client I receive this packet and want to do, whatever server has asked to do. What I tried already: I've been looking at the existing sources, however the built-in packet handlers have access to Minecraft instance, while this instance is not passed in any way to the packet handler instantiated by Forge. The EntityPlayerSP class has Minecraft instance, however it's protected and not exposed by any methods of the class. Is there any way I can access the Minecraft instance from packet handler context?
April 18, 201312 yr Author Just a quick question: How to access an open gui on client, from a context of packet handler? What I try to achieve: Server sends a custom packet to client to update the gui screen with some data. On client I receive this packet and want to do, whatever server has asked to do. What I tried already: I've been looking at the existing sources, however the built-in packet handlers have access to Minecraft instance, while this instance is not passed in any way to the packet handler instantiated by Forge. The EntityPlayerSP class has Minecraft instance, however it's protected and not exposed by any methods of the class. Is there any way I can access the Minecraft instance from packet handler context?
April 18, 201312 yr just send it to the gui: //pseudo code public void onPacketData(DataInpuStream d){ if(!Minecraft.getMinecraft.inGameHasFocus && Minecraft.getMinecraft().currentScreen instanceof YourGuiScreen) ((YourGuiScreen)Minecraft.getMinecraft().currentScreen()).handlePacketData(d); } I think its my java of the variables.
April 18, 201312 yr just send it to the gui: //pseudo code public void onPacketData(DataInpuStream d){ if(!Minecraft.getMinecraft.inGameHasFocus && Minecraft.getMinecraft().currentScreen instanceof YourGuiScreen) ((YourGuiScreen)Minecraft.getMinecraft().currentScreen()).handlePacketData(d); } I think its my java of the variables.
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.