Skip to content

Commit

Permalink
Merge pull request #1825 from Cyramek/fix-reach
Browse files Browse the repository at this point in the history
fix wrongly ported reach changes from grim 3.0
  • Loading branch information
SamB440 authored Nov 25, 2024
2 parents 48eff61 + 6ce2bcb commit d85c1d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ac/grim/grimac/utils/nmsutil/ReachUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ public static boolean isVecInside(SimpleCollisionBox self, Vector vec) {
}

public static double getMinReachToBox(GrimPlayer player, SimpleCollisionBox targetBox) {
boolean giveMovementThresholdLenience = player.packetStateData.didLastMovementIncludePosition || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9);
boolean giveMovementThresholdLenience = !player.packetStateData.didLastMovementIncludePosition || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9);
if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) targetBox.expand(0.1);

double lowest = Double.MAX_VALUE;

if (giveMovementThresholdLenience) targetBox.expand(player.getMovementThreshold());
final double[] possibleEyeHeights = player.getPossibleEyeHeights();
for (double eyes : possibleEyeHeights) {
if (giveMovementThresholdLenience) targetBox.expand(player.getMovementThreshold());
Vector from = new Vector(player.x, player.y + eyes, player.z);
Vector closestPoint = VectorUtils.cutBoxToVector(from, targetBox);
lowest = Math.min(lowest, closestPoint.distance(from));
Expand Down

0 comments on commit d85c1d2

Please sign in to comment.