From 97e6012266073ad8234f179ce3c0d78ccd6b2aec Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Sat, 8 Mar 2025 20:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AD=90=E5=BC=B9=E4=BC=A4?= =?UTF-8?q?=E5=AE=B3=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/projectile/ProjectileEntity.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java index 62427822f..da7576d1e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java @@ -714,23 +714,21 @@ public class ProjectileEntity extends Projectile implements IEntityAdditionalSpa this.xRotO = this.getXRot(); } - private void performDamage(Entity entity, float damage, boolean headshot) { + private void performDamage(Entity entity, float damage, boolean isHeadshot) { float rate = Mth.clamp(this.bypassArmorRate, 0, 1); float normalDamage = damage * Mth.clamp(1 - rate, 0, 1); float absoluteDamage = damage * Mth.clamp(rate, 0, 1); entity.invulnerableTime = 0; - if (headshot) { - entity.hurt(ModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.shooter), normalDamage * this.headShot); - entity.invulnerableTime = 0; - entity.hurt(ModDamageTypes.causeGunFireHeadshotAbsoluteDamage(this.level().registryAccess(), this, this.shooter), absoluteDamage * this.headShot); - entity.invulnerableTime = 0; - } else { - entity.hurt(ModDamageTypes.causeGunFireDamage(this.level().registryAccess(), this, this.shooter), normalDamage); + float headShotModifier = isHeadshot ? this.headShot : 1; + if (normalDamage > 0) { + entity.hurt(ModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.shooter), normalDamage * headShotModifier); entity.invulnerableTime = 0; - entity.hurt(ModDamageTypes.causeGunFireAbsoluteDamage(this.level().registryAccess(), this, this.shooter), absoluteDamage); + } + if (absoluteDamage > 0) { + entity.hurt(ModDamageTypes.causeGunFireHeadshotAbsoluteDamage(this.level().registryAccess(), this, this.shooter), absoluteDamage * headShotModifier); entity.invulnerableTime = 0; //大于1的穿甲对载具造成额外伤害