1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-18 23:23:19 +01:00

Fix locate command dist overflow/underflow ()

This commit is contained in:
Creeam 2025-01-12 08:55:45 -08:00 committed by GitHub
parent 76617ddf43
commit 86c6308faf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}
}