Applying motion to the player/targeted entity? #2075
-
I've been trying to apply motion to the player for over 2 hours, but nothing seems to work. All the examples I've looked at (projectile code) just seem to be using #setVelocity(), but when I do that it doesn't do anything. I just want to be able to apply motion via a command. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
setVelocity and updateVelocity both work (in different ways) but must be called via the server not the client. |
Beta Was this translation helpful? Give feedback.
-
See this previous discussion which is largely a repeat of some your questions: #1949 As to your specific requirement, just look at |
Beta Was this translation helpful? Give feedback.
See this previous discussion which is largely a repeat of some your questions: #1949
As to your specific requirement, just look at
net.minecraft.server.command.TeleportCommand
and change it to alter the player's velocity instead of doing a teleport.It's also possible to
ServerCommandSource.getPlayer()
so the player is implicitly the player running the command, instead of specifying the player as a parameter (the target) like the teleport command does.