You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prevent NaN velocity and crash for 0 powered explosion (#13366)
Prevents a 0 explosion_power explosion at the exact location of an entity from producing a NaN delta
due to dividing 0 by 0.
Such velocities lead to faulty client state and server crashes.
Copy file name to clipboardExpand all lines: paper-server/patches/sources/net/minecraft/world/level/ServerExplosion.java.patch
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@
64
64
}
65
65
66
66
d3 += d * 0.3F;
67
-
@@ -176,8 +_,8 @@
67
+
@@ -176,27 +_,64 @@
68
68
int floor3 = Mth.floor(this.center.y + f + 1.0);
69
69
int floor4 = Mth.floor(this.center.z - f - 1.0);
70
70
int floor5 = Mth.floor(this.center.z + f + 1.0);
@@ -74,8 +74,9 @@
74
74
+ for (Entity entity : list) { // Paper - used in loop
75
75
if (!entity.ignoreExplosion(this)) {
76
76
double d = Math.sqrt(entity.distanceToSqr(this.center)) / f;
77
+
+ if (Double.isNaN(d)) d = Double.POSITIVE_INFINITY; // Paper - avoid infinite damage/velocity when distance and radius are 0 - +inf is chosen as 0+h / 0 is evaluated to +inf for all positive h, which distanceSqrt complies with
0 commit comments