Code cleanup

This commit is contained in:
FlorianMichael 2024-02-06 22:03:59 +01:00
parent 3b29c948f4
commit ecd38de782
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126

View File

@ -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);
}
}
}