From dde769254ed2c27f5602dd9a33dfe6957d9b02c5 Mon Sep 17 00:00:00 2001 From: etil2jz Date: Tue, 15 Feb 2022 19:47:03 +0100 Subject: [PATCH] Stop large look changes from crashing the server --- ...ge-look-changes-from-crashing-the-se.patch | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 patches/server/0112-PaperPR-Stop-large-look-changes-from-crashing-the-se.patch diff --git a/patches/server/0112-PaperPR-Stop-large-look-changes-from-crashing-the-se.patch b/patches/server/0112-PaperPR-Stop-large-look-changes-from-crashing-the-se.patch new file mode 100644 index 0000000..852e63b --- /dev/null +++ b/patches/server/0112-PaperPR-Stop-large-look-changes-from-crashing-the-se.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MWHunter +Date: Tue, 8 Feb 2022 22:03:15 -0600 +Subject: [PATCH] PaperPR Stop large look changes from crashing the server + +Taken from https://github.com/PaperMC/Paper/pull/7459 + +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index bbc27000f6510209806f3f95925c11ed51f80806..1627e8dbee031c946ff59b6456748492d9822a9f 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -2962,37 +2962,12 @@ public abstract class LivingEntity extends Entity { + this.level.getProfiler().pop(); + this.level.getProfiler().push("rangeChecks"); + +- while (this.getYRot() - this.yRotO < -180.0F) { +- this.yRotO -= 360.0F; +- } +- +- while (this.getYRot() - this.yRotO >= 180.0F) { +- this.yRotO += 360.0F; +- } +- +- while (this.yBodyRot - this.yBodyRotO < -180.0F) { +- this.yBodyRotO -= 360.0F; +- } +- +- while (this.yBodyRot - this.yBodyRotO >= 180.0F) { +- this.yBodyRotO += 360.0F; +- } +- +- while (this.getXRot() - this.xRotO < -180.0F) { +- this.xRotO -= 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; +- } ++ // Paper start - Stop large pitch and yaw changes from crashing the server ++ this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; ++ this.yBodyRotO += Math.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F; ++ this.xRotO += Math.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F; ++ this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; ++ // Paper end + + this.level.getProfiler().pop(); + this.animStep += f2;