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

I've been looking on a way to "stun" the player. I created this tile entity that teleports players around, however, it takes a while to "cast" in order to teleport, is there any way to keep the player from moving during this "cast"?

 

EDIT: It takes a while to transport the player because of the nice sound it has xD

 

Thanks,

Alanzote.

You could set EntityPlayer#motionX, EntityPlayer#motionY and EntityPlayer#motionZ to zero every tick of the tile entity. Beware that this needs to be done on the client.

  • Author

You could set EntityPlayer#motionX, EntityPlayer#motionY and EntityPlayer#motionZ to zero every tick of the tile entity. Beware that this needs to be done on the client.

I got to keep 1 variable synced in the client and in the server, I forgot how to do that :/

 

Edit: Networking messages?

You need to tell the player's client that they're not allowed to move.  The entity motionX/Y/Z values don't actually do anything on the server with regards to the player.

 

Couple ways to potentially handle it:

1) intercept/cancel the input during the keypress event

2) prevent the motion the key input causes (I believe that this would be the entity motionX/Y/Z values)

3) This wouldn't require custom packets at all: hit the player with X seconds of Slowness 7.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Because you are doing this in a tile entity you can also make a server side countdown for the cast and when the player first arrives at the tile entity (before the cast) and after the cast completed, you change a boolean and call notifyBlockUpdate() (I think that is what it is called) to sync the changed boolean to the client.

  • Author

Slowness 7 worked, but it adds an effect in the screen, which, kind of removes the seen particle effects that the tileentity spawns.

The notifyBlockUpdate() function does not exist, there is a notify() and notifyAll() function, but I don't think I understand what those do.

The methods notify() and notifyAll() are from java.lang.Object.class. The method needs parameters I mentioned has parameters.

  • Author

Uh... I am unable to find a function to sync the data. According to eclipse, the notify() and notifyAll() (java.lang.Object.class) have no parameters and no return values.

The methods notify() and notifyAll() are from java.lang.Object.class. The method needs parameters I mentioned has parameters.

 

And because they're from the Object class, they will totally do what you need them to.

(Hint: no they won't because vanilla hasn't overridden them to do anything)

 

If you don't want the FOV change then you'll have to use methods 1 or 2 that I suggested.  You'll need to use packets.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

Yeah, I noticed. It is jus a matter for implementing my own message then, I did it before.

I was wondering if there was another way without the use of messages, but, there isn't.

 

Thanks for the help,

Alanzote

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.