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-04-12 21:14:06 +02:00
|
|
|
index 2b7325d3bcea2175ec22a45101f5bbaf29c2231a..09a26622db4bb4b504f735454e2b031f4840b092 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
|
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent
258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor
ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD
CraftBukkit Changes:
98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire
a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent
5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class
76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor
Spigot Changes:
e9ec5485 Rebuild patches
f1b62e0c Rebuild patches
2024-02-23 14:37:33 +01:00
|
|
|
@@ -3076,37 +3076,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-01-22 21:04:08 +01:00
|
|
|
index 20842ed5b730dda88efd0cda9292a37f879a4017..0a207f3f2e4c0790e784fb4b0c3c2dfa49c39724 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
|
2023-12-06 21:09:14 +01:00
|
|
|
@@ -259,13 +259,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);
|
|
|
|
}
|