From 29b92a5b27b2e1897c026ec21a3b13ad13a30d7f Mon Sep 17 00:00:00 2001 From: aromaa Date: Thu, 12 Oct 2023 15:00:46 +0300 Subject: [PATCH] Fix critical hit damage on vanilla --- .../main/java/org/spongepowered/forge/hook/ForgeEventHooks.java | 2 +- .../mixin/core/world/entity/player/PlayerMixin_Attack_Impl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/forge/src/main/java/org/spongepowered/forge/hook/ForgeEventHooks.java b/forge/src/main/java/org/spongepowered/forge/hook/ForgeEventHooks.java index 5a6c3ac87af..8ebe54b6ffc 100644 --- a/forge/src/main/java/org/spongepowered/forge/hook/ForgeEventHooks.java +++ b/forge/src/main/java/org/spongepowered/forge/hook/ForgeEventHooks.java @@ -66,7 +66,7 @@ public void callItemDestroyedEvent( public CriticalHitResult callCriticalHitEvent( final Player player, final Entity targetEntity, final boolean isCriticalAttack, final float v ) { - final CriticalHitEvent hitResult = ForgeHooks.getCriticalHit(player, targetEntity, isCriticalAttack, v); + final CriticalHitEvent hitResult = ForgeHooks.getCriticalHit(player, targetEntity, isCriticalAttack, v + 1.0F); if (hitResult != null) { return new CriticalHitResult(true, hitResult.getDamageModifier() - 1.0F); } diff --git a/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/player/PlayerMixin_Attack_Impl.java b/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/player/PlayerMixin_Attack_Impl.java index 2d73ff617d7..00fdcb314bd 100644 --- a/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/player/PlayerMixin_Attack_Impl.java +++ b/src/mixins/java/org/spongepowered/common/mixin/core/world/entity/player/PlayerMixin_Attack_Impl.java @@ -191,7 +191,7 @@ public void attack(final Entity targetEntity) { isCriticalAttack = isStrongAttack && this.fallDistance > 0.0F && !this.onGround && !this.shadow$onClimbable() && !this.shadow$isInWater() && !this.shadow$hasEffect( MobEffects.BLINDNESS) && !this.shadow$isPassenger() && targetEntity instanceof LivingEntity; isCriticalAttack = isCriticalAttack && !this.shadow$isSprinting(); - final EventHooks.CriticalHitResult criticalResult = PlatformHooks.INSTANCE.getEventHooks().callCriticalHitEvent((net.minecraft.world.entity.player.Player) (Object) this, targetEntity, isCriticalAttack, isCriticalAttack ? 1.5F : 1.0F); + final EventHooks.CriticalHitResult criticalResult = PlatformHooks.INSTANCE.getEventHooks().callCriticalHitEvent((net.minecraft.world.entity.player.Player) (Object) this, targetEntity, isCriticalAttack, isCriticalAttack ? 0.5F : 0.0F); isCriticalAttack = criticalResult.criticalHit; if (isCriticalAttack) { // Sponge Start - add critical attack tuple