Skip to content

Commit

Permalink
Changed block breaking progress calculation in 1.20 -> 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Nov 12, 2023
1 parent 6505c85 commit 45c8f03
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public abstract class MixinClientPlayerInteractionManager {
@Shadow
private BlockPos currentBreakingPos;

@Shadow private float currentBreakingProgress;
@Unique
private ItemStack viafabricplus_oldCursorStack;

Expand Down Expand Up @@ -195,4 +196,11 @@ public void handleBlockAcknowledgements(ClientWorld world, SequencedPacketCreato
ClientPlayerInteractionManager1_18_2.trackBlockAction(playerActionC2SPacket.getAction(), playerActionC2SPacket.getPos());
}
}

@Inject(method = "getBlockBreakingProgress", at = @At("HEAD"), cancellable = true)
public void changeCalculation(CallbackInfoReturnable<Integer> cir) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
cir.setReturnValue((int)(this.currentBreakingProgress * 10.0F) - 1);
}
}
}

0 comments on commit 45c8f03

Please sign in to comment.