Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Nov 27, 2024
1 parent b22690e commit bb26475
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public void onBlockBreak(BlockBreak blockBreak) {
double threshold = player.getMovementThreshold();
maxReach += Math.hypot(threshold, threshold);

if (min > maxReach * maxReach) {
if (flagAndAlert("distance=" + Math.sqrt(min)) && shouldModifyPackets()) {
blockBreak.cancel();
}
if (min > maxReach * maxReach && flagAndAlert(String.format("distance=%.2f", Math.sqrt(min))) && shouldModifyPackets()) {
blockBreak.cancel();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ public void onPacketReceive(PacketReceiveEvent event) {
player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)
? event.getPacketType() == PacketType.Play.Client.ANIMATION
: WrapperPlayClientPlayerFlying.isFlying(event.getPacketType())
)) {
maximumBlockDamage = Math.max(maximumBlockDamage, BlockBreakSpeed.getBlockDamage(player, targetBlock));
}
)) maximumBlockDamage = Math.max(maximumBlockDamage, BlockBreakSpeed.getBlockDamage(player, targetBlock));
}

private void clampBalance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,15 @@ public void onBlockBreak(BlockBreak blockBreak) {

// So now we have the player's possible eye positions
// So then look at the face that the player has clicked
boolean flag = false;
switch (blockBreak.face) {
case NORTH: // Z- face
flag = eyePositions.minZ > combined.minZ;
break;
case SOUTH: // Z+ face
flag = eyePositions.maxZ < combined.maxZ;
break;
case EAST: // X+ face
flag = eyePositions.maxX < combined.maxX;
break;
case WEST: // X- face
flag = eyePositions.minX > combined.minX;
break;
case UP: // Y+ face
flag = eyePositions.maxY < combined.maxY;
break;
case DOWN: // Y- face
flag = eyePositions.minY > combined.minY;
break;
}
boolean flag = switch (blockBreak.face) {
case NORTH -> eyePositions.minZ > combined.minZ; // Z- face
case SOUTH -> eyePositions.maxZ < combined.maxZ; // Z+ face
case EAST -> eyePositions.maxX < combined.maxX; // X+ face
case WEST -> eyePositions.minX > combined.minX; // X- face
case UP -> eyePositions.maxY < combined.maxY; // Y+ face
case DOWN -> eyePositions.minY > combined.minY; // Y- face
default -> false;
};

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

0 comments on commit bb26475

Please sign in to comment.