The Bug
ServerboundMovePlayerPacket's xRot can have invalid(90 over or -90 under) value.
An xRot value greater than 90 or less than -90 is an xRot value that players cannot have.
Can check it enter the command
/tp @s ~ ~ ~ ~ -180
or look at the sky and enter the command
/tp @s ~ ~ ~ ~ ~-5
In special cases, the client can also cause packet spam. (ex. send -95 to the server and immediately send -90)
Code analysis
net.minecraft.client.multiplayer.ClientPacketListener
@Override public void handleMovePlayer(ClientboundPlayerPositionPacket packet) { // ... localPlayer.setPos(d1, d3, d5); localPlayer.setDeltaMovement(d0, d2, d4); float f = packet.getYRot(); float f1 = packet.getXRot(); if (packet.getRelativeArguments().contains(ClientboundPlayerPositionPacket.RelativeArgument.X_ROT)) { // If the player's current xRot is -90 and the "float f1" is -1, the player's xRot will be -91. // and the client sends -91 to the server. localPlayer.setXRot(localPlayer.getXRot() + f1); localPlayer.xRotO += f1; // fix example (this would not be a good way) // localPlayer.setXRot(Mth.clamp(localPlayer.getXRot() + f1, -90.0F, 90.0F)); // localPlayer.xRotO = Mth.clamp(localPlayer.xRotO + f1, -90.0F, 90.0F); } else { // It's the same. localPlayer.setXRot(f1); localPlayer.xRotO = f1; } // ... this.connection.send(new ServerboundAcceptTeleportationPacket(packet.getId())); this.connection.send(new ServerboundMovePlayerPacket.PosRot(localPlayer.getX(), localPlayer.getY(), localPlayer.getZ(), localPlayer.getYRot(), localPlayer.getXRot(), false)); }