Skip to content

Commit 1ff02e8

Browse files
committed
fix build
1 parent 32c1975 commit 1ff02e8

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

src/main/java/ac/grim/grimac/checks/impl/breaking/FastBreakA.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ private void clampBalance() {
117117
}
118118

119119
private boolean isDisabled() {
120-
return player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && GrimAPI.INSTANCE.getConfigManager().isExperimentalChecks();
120+
return player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && player.isExperimentalChecks();
121121
}
122122
}

src/main/java/ac/grim/grimac/checks/impl/breaking/FastBreakB.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,15 @@ private boolean isWithinRange() {
9191
private boolean didRayTraceHit() {
9292
SimpleCollisionBox box = new SimpleCollisionBox(targetBlock);
9393

94+
final double[] possibleEyeHeights = player.getPossibleEyeHeights();
95+
9496
// Start checking if player is in the block
95-
double minEyeHeight = Collections.min(player.getPossibleEyeHeights());
96-
double maxEyeHeight = Collections.max(player.getPossibleEyeHeights());
97+
double minEyeHeight = Double.MAX_VALUE;
98+
double maxEyeHeight = Double.MIN_VALUE;
99+
for (double height : possibleEyeHeights) {
100+
minEyeHeight = Math.min(minEyeHeight, height);
101+
maxEyeHeight = Math.max(maxEyeHeight, height);
102+
}
97103

98104
SimpleCollisionBox eyePositions = new SimpleCollisionBox(player.lastX, player.lastY + minEyeHeight, player.lastZ, player.lastX, player.lastY + maxEyeHeight, player.lastZ);
99105
eyePositions.expand(player.getMovementThreshold());
@@ -120,7 +126,7 @@ private boolean didRayTraceHit() {
120126
}
121127

122128
final double distance = player.compensatedEntities.getSelf().getAttributeValue(Attributes.PLAYER_BLOCK_INTERACTION_RANGE);
123-
for (double d : player.getPossibleEyeHeights()) {
129+
for (double d : possibleEyeHeights) {
124130
for (Vector3f lookDir : possibleLookDirs) {
125131
Vector3d starting = new Vector3d(player.lastX, player.lastY + d, player.lastZ);
126132
Ray trace = new Ray(player, starting.getX(), starting.getY(), starting.getZ(), lookDir.getX(), lookDir.getY());

src/main/java/ac/grim/grimac/checks/impl/breaking/PositionBreakA.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ public void onBlockBreak(BlockBreak blockBreak) {
2929
// Each position represents the best case scenario to have clicked
3030
//
3131
// We will now calculate the most optimal position for the player's head to be in
32-
double minEyeHeight = Collections.min(player.getPossibleEyeHeights());
33-
double maxEyeHeight = Collections.max(player.getPossibleEyeHeights());
32+
33+
final double[] possibleEyeHeights = player.getPossibleEyeHeights();
34+
double minEyeHeight = Double.MAX_VALUE;
35+
double maxEyeHeight = Double.MIN_VALUE;
36+
for (double height : possibleEyeHeights) {
37+
minEyeHeight = Math.min(minEyeHeight, height);
38+
maxEyeHeight = Math.max(maxEyeHeight, height);
39+
}
3440
// I love the idle packet, why did you remove it mojang :(
3541
// 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
3642
double movementThreshold = !player.packetStateData.didLastMovementIncludePosition || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) ? player.getMovementThreshold() : 0;

src/main/java/ac/grim/grimac/checks/impl/breaking/RotationBreak.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,15 @@ public void onPostFlyingBlockBreak(BlockBreak blockBreak) {
7070
private boolean didRayTraceHit(BlockBreak blockBreak) {
7171
SimpleCollisionBox box = new SimpleCollisionBox(blockBreak.position);
7272

73+
final double[] possibleEyeHeights = player.getPossibleEyeHeights();
74+
7375
// Start checking if player is in the block
74-
double minEyeHeight = Collections.min(player.getPossibleEyeHeights());
75-
double maxEyeHeight = Collections.max(player.getPossibleEyeHeights());
76+
double minEyeHeight = Double.MAX_VALUE;
77+
double maxEyeHeight = Double.MIN_VALUE;
78+
for (double height : possibleEyeHeights) {
79+
minEyeHeight = Math.min(minEyeHeight, height);
80+
maxEyeHeight = Math.max(maxEyeHeight, height);
81+
}
7682

7783
SimpleCollisionBox eyePositions = new SimpleCollisionBox(player.x, player.y + minEyeHeight, player.z, player.x, player.y + maxEyeHeight, player.z);
7884
eyePositions.expand(player.getMovementThreshold());
@@ -99,7 +105,7 @@ private boolean didRayTraceHit(BlockBreak blockBreak) {
99105
}
100106

101107
final double distance = player.compensatedEntities.getSelf().getAttributeValue(Attributes.PLAYER_BLOCK_INTERACTION_RANGE);
102-
for (double d : player.getPossibleEyeHeights()) {
108+
for (double d : possibleEyeHeights) {
103109
for (Vector3f lookDir : possibleLookDirs) {
104110
Vector3d starting = new Vector3d(player.x, player.y + d, player.z);
105111
Ray trace = new Ray(player, starting.getX(), starting.getY(), starting.getZ(), lookDir.getX(), lookDir.getY());

0 commit comments

Comments
 (0)