Skip to content

Commit

Permalink
Fix locate command dist overflow/underflow (#11956)
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH authored Jan 12, 2025
1 parent 76617dd commit 86c6308
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/net/minecraft/server/commands/LocateCommand.java
+++ b/net/minecraft/server/commands/LocateCommand.java
@@ -202,6 +_,6 @@
private static float dist(int x1, int z1, int x2, int z2) {
int i = x2 - x1;
int i1 = z2 - z1;
- return Mth.sqrt(i * i + i1 * i1);
+ return (float) Math.hypot(i, i1); // Paper - Fix MC-177381
}
}

0 comments on commit 86c6308

Please sign in to comment.