Skip to content

Commit 5561b6c

Browse files
committed
cleanup
1 parent 7f7674b commit 5561b6c

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@ public void onBlockBreak(BlockBreak blockBreak) {
3535
double threshold = player.getMovementThreshold();
3636
maxReach += Math.hypot(threshold, threshold);
3737

38-
if (min > maxReach * maxReach) {
39-
if (flagAndAlert("distance=" + Math.sqrt(min)) && shouldModifyPackets()) {
40-
blockBreak.cancel();
41-
}
38+
if (min > maxReach * maxReach && flagAndAlert(String.format("distance=%.2f", Math.sqrt(min))) && shouldModifyPackets()) {
39+
blockBreak.cancel();
4240
}
4341
}
4442
}

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ public void onPacketReceive(PacketReceiveEvent event) {
104104
player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)
105105
? event.getPacketType() == PacketType.Play.Client.ANIMATION
106106
: WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())
107-
)) {
108-
maximumBlockDamage = Math.max(maximumBlockDamage, BlockBreakSpeed.getBlockDamage(player, targetBlock));
109-
}
107+
)) maximumBlockDamage = Math.max(maximumBlockDamage, BlockBreakSpeed.getBlockDamage(player, targetBlock));
110108
}
111109

112110
private void clampBalance() {

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

+9-21
Original file line numberDiff line numberDiff line change
@@ -48,27 +48,15 @@ public void onBlockBreak(BlockBreak blockBreak) {
4848

4949
// So now we have the player's possible eye positions
5050
// So then look at the face that the player has clicked
51-
boolean flag = false;
52-
switch (blockBreak.face) {
53-
case NORTH: // Z- face
54-
flag = eyePositions.minZ > combined.minZ;
55-
break;
56-
case SOUTH: // Z+ face
57-
flag = eyePositions.maxZ < combined.maxZ;
58-
break;
59-
case EAST: // X+ face
60-
flag = eyePositions.maxX < combined.maxX;
61-
break;
62-
case WEST: // X- face
63-
flag = eyePositions.minX > combined.minX;
64-
break;
65-
case UP: // Y+ face
66-
flag = eyePositions.maxY < combined.maxY;
67-
break;
68-
case DOWN: // Y- face
69-
flag = eyePositions.minY > combined.minY;
70-
break;
71-
}
51+
boolean flag = switch (blockBreak.face) {
52+
case NORTH -> eyePositions.minZ > combined.minZ; // Z- face
53+
case SOUTH -> eyePositions.maxZ < combined.maxZ; // Z+ face
54+
case EAST -> eyePositions.maxX < combined.maxX; // X+ face
55+
case WEST -> eyePositions.minX > combined.minX; // X- face
56+
case UP -> eyePositions.maxY < combined.maxY; // Y+ face
57+
case DOWN -> eyePositions.minY > combined.minY; // Y- face
58+
default -> false;
59+
};
7260

7361
if (flag && flagAndAlert("action=" + blockBreak.action) && shouldModifyPackets()) {
7462
blockBreak.cancel();

0 commit comments

Comments
 (0)