2022-09-17 05:30:00 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: MWHunter <s0521458@student.rockvalleycollege.edu>
|
|
|
|
Date: Wed, 24 Aug 2022 09:54:11 -0400
|
|
|
|
Subject: [PATCH] Stop large look changes from crashing the server
|
|
|
|
|
|
|
|
Co-authored-by: Jaren Knodel <Jaren@Knodel.com>
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2024-06-15 18:28:18 +02:00
|
|
|
index 8e11b085d2159b1df8bbe536beb66d9bed915373..1d6179d54ff2264d3489770b23fc7ba479c17f25 100644
|
2022-09-17 05:30:00 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2024-06-14 03:30:23 +02:00
|
|
|
@@ -3129,37 +3129,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
2023-06-08 10:47:19 +02:00
|
|
|
this.level().getProfiler().pop();
|
|
|
|
this.level().getProfiler().push("rangeChecks");
|
2022-09-17 05:30:00 +02:00
|
|
|
|
|
|
|
- while (this.getYRot() - this.yRotO < -180.0F) {
|
|
|
|
- this.yRotO -= 360.0F;
|
|
|
|
- }
|
2023-03-23 22:57:03 +01:00
|
|
|
-
|
2022-09-17 05:30:00 +02:00
|
|
|
- while (this.getYRot() - this.yRotO >= 180.0F) {
|
|
|
|
- this.yRotO += 360.0F;
|
|
|
|
- }
|
2023-03-23 22:57:03 +01:00
|
|
|
+ // Paper start - stop large pitch and yaw changes from crashing the server
|
|
|
|
+ this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F;
|
2022-09-17 05:30:00 +02:00
|
|
|
|
|
|
|
- while (this.yBodyRot - this.yBodyRotO < -180.0F) {
|
|
|
|
- this.yBodyRotO -= 360.0F;
|
|
|
|
- }
|
2023-03-23 22:57:03 +01:00
|
|
|
+ this.yBodyRotO += Math.round((this.yBodyRot - this.yBodyRotO) / 360.0F) * 360.0F;
|
2022-09-17 05:30:00 +02:00
|
|
|
|
|
|
|
- while (this.yBodyRot - this.yBodyRotO >= 180.0F) {
|
|
|
|
- this.yBodyRotO += 360.0F;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- while (this.getXRot() - this.xRotO < -180.0F) {
|
|
|
|
- this.xRotO -= 360.0F;
|
|
|
|
- }
|
2023-03-23 22:57:03 +01:00
|
|
|
+ this.xRotO += Math.round((this.getXRot() - this.xRotO) / 360.0F) * 360.0F;
|
|
|
|
|
2022-09-17 05:30:00 +02:00
|
|
|
- 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
|
|
|
|
|
2023-06-08 10:47:19 +02:00
|
|
|
this.level().getProfiler().pop();
|
2022-09-17 05:30:00 +02:00
|
|
|
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
|
2024-06-14 03:30:23 +02:00
|
|
|
index ff6007bbf8361db7967b6bf621b27a1d23102e77..d147f3cc1af28c384005c1c20e37bb588588c88d 100644
|
2022-09-17 05:30:00 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
2024-06-14 03:30:23 +02:00
|
|
|
@@ -310,13 +310,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
2022-09-17 05:30:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|