diff --git a/src/main/java/ac/grim/grimac/checks/impl/scaffolding/PositionPlace.java b/src/main/java/ac/grim/grimac/checks/impl/scaffolding/PositionPlace.java index 3b20196c04..2dec8c7fcb 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/scaffolding/PositionPlace.java +++ b/src/main/java/ac/grim/grimac/checks/impl/scaffolding/PositionPlace.java @@ -28,8 +28,13 @@ public void onBlockPlace(final BlockPlace place) { // Each position represents the best case scenario to have clicked // // We will now calculate the most optimal position for the player's head to be in - double minEyeHeight = Collections.min(player.getPossibleEyeHeights()); - double maxEyeHeight = Collections.max(player.getPossibleEyeHeights()); + double[] possibleEyeHeights = player.getPossibleEyeHeights(); + double minEyeHeight = Double.MAX_VALUE; + double maxEyeHeight = Double.MIN_VALUE; + for (double height : possibleEyeHeights) { + minEyeHeight = Math.min(minEyeHeight, height); + maxEyeHeight = Math.max(maxEyeHeight, height); + } // I love the idle packet, why did you remove it mojang :( // Don't give 0.03 lenience if the player is a 1.8 player and we know they couldn't have 0.03'd because idle packet double movementThreshold = !player.packetStateData.didLastMovementIncludePosition || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) ? player.getMovementThreshold() : 0; diff --git a/src/main/java/ac/grim/grimac/checks/impl/scaffolding/RotationPlace.java b/src/main/java/ac/grim/grimac/checks/impl/scaffolding/RotationPlace.java index e1081c4d9e..3c7ca7dfad 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/scaffolding/RotationPlace.java +++ b/src/main/java/ac/grim/grimac/checks/impl/scaffolding/RotationPlace.java @@ -75,9 +75,15 @@ private boolean didRayTraceHit(BlockPlace place) { new Vector3f(player.xRot, player.yRot, 0) )); + double[] possibleEyeHeights = player.getPossibleEyeHeights(); + // Start checking if player is in the block - double minEyeHeight = Collections.min(player.getPossibleEyeHeights()); - double maxEyeHeight = Collections.max(player.getPossibleEyeHeights()); + double minEyeHeight = Double.MAX_VALUE; + double maxEyeHeight = Double.MIN_VALUE; + for (double height : possibleEyeHeights) { + minEyeHeight = Math.min(minEyeHeight, height); + maxEyeHeight = Math.max(maxEyeHeight, height); + } SimpleCollisionBox eyePositions = new SimpleCollisionBox(player.x, player.y + minEyeHeight, player.z, player.x, player.y + maxEyeHeight, player.z); eyePositions.expand(player.getMovementThreshold()); @@ -99,7 +105,7 @@ private boolean didRayTraceHit(BlockPlace place) { } final double distance = player.compensatedEntities.getSelf().getAttributeValue(Attributes.PLAYER_BLOCK_INTERACTION_RANGE); - for (double d : player.getPossibleEyeHeights()) { + for (double d : possibleEyeHeights) { for (Vector3f lookDir : possibleLookDirs) { // x, y, z are correct for the block placement even after post tick because of code elsewhere Vector3d starting = new Vector3d(player.x, player.y + d, player.z);