Jump to content

Recommended Posts

Posted

I made a small and simple test mod to try to understand how packets work for a larger mod. This is a boat mod that when a key is pressed, the boat speeds up. Offline it works just fine, on the server it crashes.

 

Crash Log

 

  Reveal hidden contents

 

 

PacketHandler

 

  Reveal hidden contents

 

 

keyhandler

 

  Reveal hidden contents

 

 

snip from the entity class

 

  Reveal hidden contents

 

 

This code came from a team member from the Fossil/Archeology mod, whos time is very limited at the moment and hasnt had a chance to help with this. I am hoping you can. Whats missing, whats broken, etc...Mazetar has helped a bit, but I am still getting lost and confused as this is my first go round with packets and keybinding.

Posted

At the same place as you check for a ridet inn the entity, check to see if the world.isRemote and only let the block of code get run on the CLIENT side.

 

The crash is because the server can'tread the key input line, it has no understanding of it and crashes.

I'm still at work so I can'tgo into detail on the other things, but understand and fix this issue first :)

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted

I tried that, and in the 2 places and the 2 different ways I added it, it will either let me in the boat and have no control at all, or crash when placing the boat. I have looked at the src for the steamship mod and also the spiderman mod and half wonder if this is even right<the way I am doing it> because neither use a key handler, and neither have the packet code in the entity class. Also both seem to use a tick handler...

Posted

I have looked at some source on github provided by GotoLink and tried to model mine using the same code more or less, and while his works for the hotairballon mine is not working for the speedboat.....I have posted my source for this to github hoping someone could take a look and let me know why. Or if there is a better way to do this, possibly show me how. I would really like to figure this out so I can apply this to another mod I am actually working on and make it so I can fly my chickens around in MP....

 

https://github.com/microjunk/speedboats

Posted

From your KeyHandler:

if (ent!=null && ent instanceof EntitySpeedBoat)

 

From here, you say that if you are driving a SpeedBoat, then you do NOTHING!!!

and else if, you do something, but you only do that IF you are not riding a entity :P

 

  Quote

If you guys dont get it.. then well ya.. try harder...

Posted

yeah, I think I see it now....duh, how did I miss that. I went through the code he had like 20 times before making changes, just to make sure I understood it. I dont know how I missed that. I am at work right now, so when I get home I will fix it. When All goes well, I should be able to add it to the other mod then just fine. Thanks for pointing that out. I tried to add you to skype, but I guess it didnt work....

Posted

Thanks for pointing that out Mazetar, with that I was able to find 2 other smaller mistakes and fix them too....All is working now, so now I can add this to the other issue I had with the actual mod this learning experience was intended for, riding vanilla mobs....

 

(whipping sound) ride that creeper, just a soon as I figure out how to stop the swell timer when mounted....

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.