Packet spam due to disagreement between client and server because of number clamping
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
Teleporting the player to location x with yaw 180 and cancelling the player move event should not cause any issues
A player teleport would get sent out → the client ACKs, the client sends its position back, the server sees the same position as originally sent out, no player move event is called, no further teleports happen.
Observed/Actual behavior
The server sends 180 degrees as yaw to the client, the client applies said rotation and sends it position back to the server.
The server applies net.minecraft.util.Mth.wrapDegrees to the returned yaw in ServerGamePacketListenerImpl#handleMovePlayer. This method converts 180 to -180 and thus calls the player move event due to the massive change in numbers. The player move event is cancelled by said plugin, the server sends a new teleport request (again with 180) and the loop begins. The server and client will never agree on the number until the player move event is no longer cancelled.
Steps/models to reproduce
- Make sure the player move event is cancelled
- Teleport the player to wherever you want as long as the yaw is exactly 180.
- Observe the packet spam or get kicked for spamming too many packets (you might need to adjust the limits as on a empty paper server it does not seem to hit the packet limit, yet the packet spam can clearly be observed using third party packet observers. On my server you get kicked 90% of the time tho)
Plugin and Datapack List
No public plugins were used
Paper version
This server is running Paper version 26.2-121-main@a2a42c5 (2026-08-29T11:32:25Z) (Implementing API version 26.2.build.121-stable)
You are running the latest version
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ServerGamePacketListenerImpl#handleMovePlayer and trace how the returned yaw is normalized before the player move event is evaluated. Reproduce with a cancelled player move event and a teleport using yaw 180, then verify that the client and server no longer enter a repeated teleport or packet-spam loop.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100