From eb360c2a571fe97374552fb30d49862ef9e85cc5 Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Fri, 20 Dec 2024 04:27:44 +0100 Subject: [PATCH] Remove BLOCK action use delay in <= 1.8 Looking at the git history, this piece of code got lost during the v3.0.0 rewrite in https://github.com/ViaVersion/ViaFabricPlus/commit/be8c3659bca3ccffe208ef7b7aa56749c616b409 and seems to be still needed after comparing the game diff Co-authored-by: lowercasebtw <126462578+lowercasebtw@users.noreply.github.com> --- .../fixes/minecraft/entity/MixinLivingEntity.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java index acbe4784d..524dcb6a1 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinLivingEntity.java @@ -240,8 +240,17 @@ private void removeShieldSlotPreference(ItemStack stack, CallbackInfoReturnable< } } + @ModifyConstant(method = "getBlockingItem", constant = @Constant(intValue = 5)) + private int removeBlockActionUseDelay(int constant) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { + return 0; + } else { + return constant; + } + } + @ModifyConstant(method = "tickMovement", constant = @Constant(doubleValue = 0.003D)) - private double modifyVelocityZero(final double constant) { + private double modifyVelocityZero(double constant) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_8)) { return 0.005D; } else {