Ensure entity yaw wraps around correctly.

In some scenarios an entity's yaw can get in an invalid state which the
server has a check to try to correct. Unfortunately the check is not
implemented correctly so these invalid values are allowed through. This
causes these entities to behave strangely. To prevent this we replace the
vanilla check with one that properly detects this scenario and corrects it.