9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-23 08:59:23 +00:00
Files
Leaf/patches/server/0127-Fix-MC-177381.patch
Kobe ⑧ 848fb2dc4d Smart sorting & Remove streams & Throttle hopper (#157)
* =-=

* Reuse comparator

* Cleanup DAB patch
2024-11-10 09:25:58 -05:00

26 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
Date: Wed, 23 Oct 2024 20:20:16 +0800
Subject: [PATCH] Fix MC-177381
Related MC issue: https://bugs.mojang.com/browse/MC-177381
diff --git a/src/main/java/net/minecraft/server/commands/LocateCommand.java b/src/main/java/net/minecraft/server/commands/LocateCommand.java
index 74a00a9b636b7457c54f9e76f60432de1701239b..39f5deea47d8f573c3cfec5df431216ee806c32c 100644
--- a/src/main/java/net/minecraft/server/commands/LocateCommand.java
+++ b/src/main/java/net/minecraft/server/commands/LocateCommand.java
@@ -197,8 +197,10 @@ public class LocateCommand {
}
private static float dist(int x1, int y1, int x2, int y2) {
- int i = x2 - x1;
- int j = y2 - y1;
- return Mth.sqrt((float)(i * i + j * j));
+ // Leaf start - Fix distance overflow MC-177381
+ double i = x2 - x1;
+ double j = y2 - y1;
+ return (float) Math.hypot(i, j);
+ // Leaf end - Fix distance overflow MC-177381
}
}