Changed block breaking progress calculation in 1.20 -> 1.19.4

This commit is contained in:
FlorianMichael 2023-11-12 22:14:03 +01:00
parent 6505c85726
commit 45c8f03912
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -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<Integer> cir) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
cir.setReturnValue((int)(this.currentBreakingProgress * 10.0F) - 1);
}
}
}