From 7e5ed3efe5c469cc603148b6ea694246c0830bf4 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 26 Aug 2023 11:09:58 -0400 Subject: [PATCH] sqrMagnitude not sqrRoot --- src/engine/mobileAI/utilities/CombatUtilities.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/mobileAI/utilities/CombatUtilities.java b/src/engine/mobileAI/utilities/CombatUtilities.java index fd52a2e3..3a0c0634 100644 --- a/src/engine/mobileAI/utilities/CombatUtilities.java +++ b/src/engine/mobileAI/utilities/CombatUtilities.java @@ -48,7 +48,7 @@ public class CombatUtilities { } public static boolean inRange2D(AbstractWorldObject entity1, AbstractWorldObject entity2, double range) { - return entity1.getLoc().distance2D(entity2.getLoc()) < range; + return entity1.getLoc().distanceSquared2D(entity2.getLoc()) < range * range; } public static void swingIsBlock(Mob agent, AbstractWorldObject target, int animation) {