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

Hey, I've been doing many things in java and tried modding out. Ok so here it is, i'm trying some semi simple things. I want to add a simple jet pack to my mod, where when you press space bar you fly. I was trying to use simple Keyboard.isKeyPressed() which then i soon realized is that you cant use this on servers for some reason with packets. I do not have experience with packets if this is indeed the case. Nor do i know if this is whats needed. I looked in the crash report and it said something about keyboard not created so i used Keyboard.create() and then i keep getting more errors.

 

Now is there a simple way to do this or do i have to make packet handlers, etc. Now if someone could guide me in the right direction and if needed i will attach my code i'm using, just ask.

 

Thank you.

Key inputs are client side only!

Try to use if(world.isRemote) above isKeyPressed().

This will ensure that code is only running client side.(It will not crash server side)

Then you have to send a packet to inform the server about you pressed the button and do other things you want.

 

For pakets i recommend you Diesieben tut. Its kinda easy!

You can find it in the Modder Support top page(Tutorials sticker).

 

Good luck!

  • Author

Ive had an error fixed using this. IT WORKS thank you soo much for pointing something obvious out to me. Ive been tryinng to mess with SideOnly because i knew it was a problem similar!

 

Now is this used with sounds server side not playing as well?

 

If you want to play sounds only for you than client side is fine.

Just use world.playSound()

If you want to play the sound so everyone can hear it you need that packet handler.

Than just use world.playSoundAtEntity().

 

Glad i can help you!

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.