Jump to content

Recommended Posts

Posted

I have tried to open my custom GUI on logging in/ spawning.

I know the code works, as the GUI opens when I respawn, but not on initial login.

 

EventHandler:

 

  Reveal hidden contents

 

 

Eclipse Output:

 

  Reveal hidden contents

 

Posted

public void onLogin(LivingSpawnEvent event)
{
	if(event.entity instanceof EntityPlayer)

Spawn is for mobs, actually...:P

 

if(!ep.hasPlayerClass())

When is this value set to true ?

Posted

Hello,

 

I think the easiest way to do this is to create a class which implements IConnectionHandler and use this function:

 

public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)

 

Thats how i do it.

 

ss7

  Quote

You sir are a god damn hero.

Posted
  On 10/24/2013 at 2:25 PM, GotoLink said:

public void onLogin(LivingSpawnEvent event)
{
	if(event.entity instanceof EntityPlayer)

Spawn is for mobs, actually...:P

Explains why adding this event handler didn't make the print statements appear twice, thanks for the explanation.

 

  Quote

if(!ep.hasPlayerClass())

When is this value set to true ?

The result of the button pressed within the GUI changes the value, or sending a command. As of yet I don't think the value is ever changed because I haven't finished my packet handler.

 

 

  Quote

I think the easiest way to do this is to create a class which implements IConnectionHandler and use this function:

 

public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)

 

Thanks, will try that. Do I need to register said class somewhere? Such as in the @Mod class?

 

EDIT: Never mind, found it. (NetworkRegistry.registerConnectionHandler())

Posted
  On 10/24/2013 at 5:29 PM, Alpvax said:

Explains why adding this event handler didn't make the print statements appear twice, thanks for the explanation.

Because they are from client and server side of the other event. You are welcome.

 

  Quote

The result of the button pressed within the GUI changes the value, or sending a command. As of yet I don't think the value is ever changed because I haven't finished my packet handler.

Which means it should always open at this point ?

I guess there is something wrong in your gui handling code, then.

Posted
  On 10/24/2013 at 5:48 PM, GotoLink said:

 

  Quote

The result of the button pressed within the GUI changes the value, or sending a command. As of yet I don't think the value is ever changed because I haven't finished my packet handler.

Which means it should always open at this point ?

I guess there is something wrong in your gui handling code, then.

 

Correct, it should always open the first time a player logs into a new world / server.

My server-side gui element is returned as null, is that what is causing the problem? Do I have to make a blank container as the gui consists of nothing but buttons, which send a packet to the server when clicked, and close the GUI

Posted
  On 10/25/2013 at 12:06 PM, GotoLink said:

You don't need a container if you don't want inventory slots.

 

Thanks for the confirmation, I didn't think so.

 

GUI class (will be re-written at some point, its a tad messy, but I know it works as it appears when I kill myself (EntityJoinWorldEvent launches it))

 

  Reveal hidden contents

 

 

And my proxy/ GUIHandler methods

 

  Reveal hidden contents

 

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.