From ecd38de78262c8528c279df939982f507952da6e Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Tue, 6 Feb 2024 22:03:59 +0100 Subject: [PATCH] Code cleanup --- .../fixes/minecraft/entity/MixinPlayerEntity.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java index 5f926647..c1451174 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinPlayerEntity.java @@ -190,16 +190,17 @@ public abstract class MixinPlayerEntity extends LivingEntity { final int efficiency = EnchantmentHelper.getEfficiency(this); if (efficiency <= 0) return; - final float fValue = this.inventory.getBlockBreakingSpeed(block); + final float speed = this.inventory.getBlockBreakingSpeed(block); + final int effLevel = efficiency * efficiency + 1; if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_4_4tor1_4_5) && this.canHarvest(block)) { - f.set(fValue + (efficiency * efficiency + 1)); - } else if (fValue > 1F || ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_4_6tor1_4_7)) { + f.set(speed + effLevel); + } else if (speed > 1F || ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_4_6tor1_4_7)) { if (!this.getMainHandStack().isEmpty()) { if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_7_6tor1_7_10)) { - if (fValue <= 1.0 && !this.canHarvest(block)) { - f.set(fValue + (efficiency * efficiency + 1) * 0.08F); + if (speed <= 1.0 && !this.canHarvest(block)) { + f.set(speed + effLevel * 0.08F); } else { - f.set(fValue + (efficiency * efficiency + 1)); + f.set(speed + effLevel); } } }