Stop large look changes from crashing the server

Co-authored-by: Jaren Knodel <Jaren@Knodel.com>
This commit is contained in:
MWHunter
2022-08-24 09:54:11 -04:00
parent a72acfb245
commit 2aae5e2218
2 changed files with 135 additions and 77 deletions

View File

@@ -163,3 +163,19 @@
return entity1 == null || this.leftOwner || !entity1.isPassengerOfSameVehicle(entity);
}
}
@@ -333,14 +413,8 @@
}
protected static float lerpRotation(float prevRot, float newRot) {
- while (newRot - prevRot < -180.0F) {
- prevRot -= 360.0F;
- }
+ prevRot += Math.round((newRot - prevRot) / 360.0F) * 360.0F; // Paper - stop large look changes from crashing the server
- while (newRot - prevRot >= 180.0F) {
- prevRot += 360.0F;
- }
-
return Mth.lerp(0.2F, prevRot, newRot);
}