9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-20 23:49:31 +00:00
Files
Leaf/patches/server/0115-Fix-MC-177381.patch
Dreeam 27134f699a Added some optimizations (#164)
* uwu

* reorder

* Change author

* Sync upstream

* Lithium: equipment tracking

* Faster CraftServer#getworlds list creation

Co-Authored-By: Kobe ⑧ <102713261+HaHaWTH@users.noreply.github.com>
2024-11-14 06:50:59 -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
}
}