aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0722-Stop-large-look-changes-from-crashing-the-server.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-12-05 11:18:29 +0100
committerNassim Jahnke <[email protected]>2024-12-05 12:20:56 +0100
commite4e24f3335609b38f460ced71d18babcf11bf9cb (patch)
tree51880d664b3444ce26d6f8cdeb3b8219e5616fca /patches/server/0722-Stop-large-look-changes-from-crashing-the-server.patch
parentc54c062e6ff742445bf7749c84106ca67090172d (diff)
downloadPaper-e4e24f3335609b38f460ced71d18babcf11bf9cb.tar.gz
Paper-e4e24f3335609b38f460ced71d18babcf11bf9cb.zip
Move around patches again
Diffstat (limited to 'patches/server/0722-Stop-large-look-changes-from-crashing-the-server.patch')
-rw-r--r--patches/server/0722-Stop-large-look-changes-from-crashing-the-server.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/patches/server/0722-Stop-large-look-changes-from-crashing-the-server.patch b/patches/server/0722-Stop-large-look-changes-from-crashing-the-server.patch
new file mode 100644
index 0000000000..9bf6f902e6
--- /dev/null
+++ b/patches/server/0722-Stop-large-look-changes-from-crashing-the-server.patch
@@ -0,0 +1,74 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: MWHunter <[email protected]>
+Date: Wed, 24 Aug 2022 09:54:11 -0400
+Subject: [PATCH] Stop large look changes from crashing the server
+
+Co-authored-by: Jaren Knodel <[email protected]>
+
+diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+index 91fc54b060d8ab5d8e60a09677afbe1b46798064..28eb50111e524bce5aadb1dd2eea14a7df0105f2 100644
+--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+@@ -3282,37 +3282,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
+ gameprofilerfiller.pop();
+ gameprofilerfiller.push("rangeChecks");
+
+- while (this.getYRot() - this.yRotO < -180.0F) {
+- this.yRotO -= 360.0F;
+- }
+-
+- while (this.getYRot() - this.yRotO >= 180.0F) {
+- this.yRotO += 360.0F;
+- }
++ // Paper start - stop large pitch and yaw changes from crashing the server
++ this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
+
+- while (this.yBodyRot - this.yBodyRotO < -180.0F) {
+- this.yBodyRotO -= 360.0F;
+- }
++ this.yBodyRotO += Math.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F;
+
+- while (this.yBodyRot - this.yBodyRotO >= 180.0F) {
+- this.yBodyRotO += 360.0F;
+- }
+-
+- while (this.getXRot() - this.xRotO < -180.0F) {
+- this.xRotO -= 360.0F;
+- }
++ this.xRotO += Math.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F;
+
+- while (this.getXRot() - this.xRotO >= 180.0F) {
+- this.xRotO += 360.0F;
+- }
+-
+- while (this.yHeadRot - this.yHeadRotO < -180.0F) {
+- this.yHeadRotO -= 360.0F;
+- }
+-
+- while (this.yHeadRot - this.yHeadRotO >= 180.0F) {
+- this.yHeadRotO += 360.0F;
+- }
++ this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F;
++ // Paper end
+
+ gameprofilerfiller.pop();
+ this.animStep += f2;
+diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+index f3781e37358f970b56e5b8de77ef224151270f1c..92bf8a3bac1146ed2393faa0f31e219288b466ca 100644
+--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
++++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+@@ -413,13 +413,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
+ }
+
+ protected static float lerpRotation(float prevRot, float newRot) {
+- while (newRot - prevRot < -180.0F) {
+- prevRot -= 360.0F;
+- }
+-
+- 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
+
+ return Mth.lerp(0.2F, prevRot, newRot);
+ }