Jump to content

[Half - solved] Key handler called twice, crash on the server side


Recommended Posts

Posted

I have a problem i couldn't solve on my own for more than a day. It seems, that keyHandler code is called not only on the client side, but also on the server side, which sucks. I wanted to use this keybind to toggle flag, which means that two packets are sent and the flag is toggled twice, staying the same.

 

Plus, it makes "real server" crash, if any player presses the button.

 

Key handler code:

 

  Reveal hidden contents

 

 

Client Proxy

 

  Reveal hidden contents

 

 

Packet Handler

 

  Reveal hidden contents

 

 

Post Init method of main mod class

 

  Reveal hidden contents

 

 

Did anybody experience similar problem? Does anyone know of how to correctly do a keybinding? Is it a FML bug perhaps, because I'm not sure if client/server side checkers work correctly now?

Posted

Thanks, diesieben07, I couldn't figure it out, ant it turns out to be so simple.

Solution

 

  Reveal hidden contents

 

 

This, however, leaves me completely idea-less when it comes to server crash.

 

Crash-log

 

  Reveal hidden contents

 

 

Mentioned line 37 in packet handler:

 

 

  Reveal hidden contents

 

FireModeHanlder.handlePacket is blank

 

  Reveal hidden contents

 

 

And send packet, called on key press looks like this:

 

 

  Reveal hidden contents

 

 

I'm not sure why it fails. I've been sending packets before, but then I always had EntityPlayer from onUpdate and onItemRightClick methods, I didn't use Minecraft.getMinecraft() before.

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.