Posted December 30, 20168 yr 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 Thanks, Alanzote.
December 30, 20168 yr 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.
December 30, 20168 yr 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?
December 30, 20168 yr 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.
December 30, 20168 yr 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.
December 30, 20168 yr 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.
December 30, 20168 yr The methods notify() and notifyAll() are from java.lang.Object.class. The method needs parameters I mentioned has parameters.
December 30, 20168 yr 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.
December 30, 20168 yr 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.
December 30, 20168 yr 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.