Jump to content

Recommended Posts

Posted

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?

Posted

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?

Posted

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.

Posted

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.

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.