Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Is this just as simple as making a KeyHandler and sending a packet on keyPressed and keyReleased?

 

Boats work by using this.riddenByEntity.motionA and translating to this.motionA, which is what I've been trying. But it's well known that boats are complete crap. I noticed that I'm having difficulty with things like jumping and moving fast. I'll randomly get teleported back, I assume the server thinks I'm trying to speedhack or something? So I'm thinking of hooking the movement keybinds (wasd) directly to Player.ridingEntity. Trouble is that I can't find where wasd is translated to movement in vanilla.

So does someone know the class for handling wasd movement? Any other advice?

Yes, pretty much as you are thinking.  (and yes, the boat code is crap)

 

I have done alot of vehicle type work for my mod (ancientwarfare.wikispaces.com) and my solution:

 

Handle client movement on the client, relay information to the server regarding input.  Do not let server update local (ridden) client, only let server relay motion and input to other clients.  That way the player riding the entity gets 100% smooth motion, done client side.  Server gets relayed position and input updates from client periodically, and relays these to other clients.  Movement on other clients is sometimes jumpy......but it was either suffer from boat issues in first-person, or let the third-party see a bit of jumping (which actually is not too bad with this model).

 

Basically--register a dummy keybind handler(see FML javadocs), tick handler on client to poll for keys pressed--actually I used a proxy class for the vehicleMovementHelper, and relayed from that--, and when input changes, relay the new change to the server (no need to relay every tick, only when changed).  Server then relays to all _other_ clients the new input/velocity/position.

 

Hopefully someone has a better model than this (as I'm looking to redo it), but it was the best solution I could find to solve the jumpiness client side.

 

I've got my source up on github, and can provide links/examples if necessary (send me a PM, or w/e).

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.