Yeah, take the current rotation, before anything is added to it. Store it in a variable. If the current movement, take the camera rotation, too far, then set the rotation back to the old, stored values.
Also, make sure that the entitypitch (x rotation), doesn't go above 179, or below -179, cause it flips round, and cause a jutter.
Also, make sure that the entitypitch (x rotation), doesn't go above 179, or below -179, cause it flips round, and cause a jutter.