From 45c8f039126477c2033ec3f2416481562c2eacf9 Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 12 Nov 2023 22:14:03 +0100 Subject: [PATCH] Changed block breaking progress calculation in 1.20 -> 1.19.4 --- .../minecraft/MixinClientPlayerInteractionManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java index 1a56c27d..ccc9427d 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinClientPlayerInteractionManager.java @@ -75,6 +75,7 @@ public abstract class MixinClientPlayerInteractionManager { @Shadow private BlockPos currentBreakingPos; + @Shadow private float currentBreakingProgress; @Unique private ItemStack viafabricplus_oldCursorStack; @@ -195,4 +196,11 @@ public abstract class MixinClientPlayerInteractionManager { ClientPlayerInteractionManager1_18_2.trackBlockAction(playerActionC2SPacket.getAction(), playerActionC2SPacket.getPos()); } } + + @Inject(method = "getBlockBreakingProgress", at = @At("HEAD"), cancellable = true) + public void changeCalculation(CallbackInfoReturnable cir) { + if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) { + cir.setReturnValue((int)(this.currentBreakingProgress * 10.0F) - 1); + } + } }