Skip to content

Commit

Permalink
Merge pull request #1846 from Axionize/remove-use-of-var
Browse files Browse the repository at this point in the history
Remove Usage of Var
  • Loading branch information
AoElite authored Dec 4, 2024
2 parents 1f3ac2a + 1c39298 commit 97abaaf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public final void handle(BlockBreak blockBreak) {
if (blockBreak.action != DiggingAction.START_DIGGING && blockBreak.action != DiggingAction.FINISHED_DIGGING)
return;

final var block = blockBreak.block.getType();
final StateType block = blockBreak.block.getType();

// Fixes false from breaking kelp underwater
// The client sends two start digging packets to the server both in the same tick. BadPacketsX gets called twice, doesn't false the first time, but falses the second
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private boolean shouldExempt(final Vector3i pos) {

public void handle(BlockBreak blockBreak) {
if (blockBreak.action == DiggingAction.START_DIGGING) {
final var pos = blockBreak.position;
final Vector3i pos = blockBreak.position;

lastBlockWasInstantBreak = getBlockDamage(player, pos) >= 1;
lastCancelledBlock = null;
Expand All @@ -50,7 +50,7 @@ public void handle(BlockBreak blockBreak) {
}

if (blockBreak.action == DiggingAction.CANCELLED_DIGGING) {
final var pos = blockBreak.position;
final Vector3i pos = blockBreak.position;

if (shouldExempt(pos)) {
lastCancelledBlock = pos;
Expand Down Expand Up @@ -78,7 +78,7 @@ public void handle(BlockBreak blockBreak) {
}

if (blockBreak.action == DiggingAction.FINISHED_DIGGING) {
final var pos = blockBreak.position;
final Vector3i pos = blockBreak.position;

// when a player looks away from the mined block, they send a cancel, and if they look at it again, they don't send another start. (thanks mojang!)
if (!pos.equals(lastCancelledBlock) && (!lastBlockWasInstantBreak || player.getClientVersion().isOlderThan(ClientVersion.V_1_14_4)) && !pos.equals(lastBlock)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ public void onPacketReceive(PacketReceiveEvent event) {
}

if (event.getPacketType() == PacketType.Play.Client.PLAYER_DIGGING) {
final var packet = new WrapperPlayClientPlayerDigging(event);
final var blockBreak = new BlockBreak(packet, player);
final WrapperPlayClientPlayerDigging packet = new WrapperPlayClientPlayerDigging(event);
final BlockBreak blockBreak = new BlockBreak(packet, player);

player.checkManager.getPacketCheck(BadPacketsX.class).handle(blockBreak);
player.checkManager.getPacketCheck(BadPacketsZ.class).handle(blockBreak);
Expand Down

0 comments on commit 97abaaf

Please sign in to comment.