Spyer Posted May 13, 2024 Posted May 13, 2024 I made a packet which send the "Y" velocity to the server. public boolean handle(Supplier<Context> ctx) { ctx.get().enqueueWork(() -> { ServerPlayer player = ctx.get().getSender(); if (player != null) { //player.sendSystemMessage(Component.literal(String.valueOf(player.getDeltaMovement()))); player.getAbilities().flying = false; Vec3 vec3 = player.getDeltaMovement(); player.setDeltaMovement(vec3.x, dy, vec3.z); player.hasImpulse = true; //player.sendSystemMessage(Component.literal(String.valueOf(player.getDeltaMovement()))); } }); return true; } Where I trying to set new movement vector (setDeltaMovement) but it is not works. But the "sendSystemMessage" works perfectly here Quote
Xoroshio Posted May 15, 2024 Posted May 15, 2024 (edited) setDeltaMovement only works on the client. this makes the animations smoother. The reason sendSystemMessage works is because you don’t have to constantly send messages from the server to the client, and a little bit of lag is ok. This is a core minecraft mechanism, but you can send custom packets over to the client to set its deltaMovement. The client has to have a way to receive the packets too. Edited May 15, 2024 by Xoroshio Quote
Recommended Posts
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.