From 86e3c9033c921faae99d6a71930105d2662ac088 Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Sun, 16 Oct 2022 11:30:59 +0800 Subject: [PATCH] prevent onAttack from firing if damage is caused by reflection --- .../atomicstryker/infernalmobs/common/EntityEventHandler.java | 2 +- .../atomicstryker/infernalmobs/common/mods/MM_Vengeance.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java b/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java index 2c85bf67e..6c6d71fd8 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java +++ b/src/main/java/atomicstryker/infernalmobs/common/EntityEventHandler.java @@ -134,7 +134,7 @@ public void onEntityLivingHurt(LivingHurtEvent event) * and attacker */ Entity attacker = event.source.getEntity(); - if (attacker != null && attacker instanceof EntityLivingBase) + if (attacker instanceof EntityLivingBase && !event.source.damageType.equals("thorns")) { mod = InfernalMobsCore.getMobModifiers((EntityLivingBase) attacker); if (mod != null) diff --git a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java index 5d7c6fef0..54031e45c 100644 --- a/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java +++ b/src/main/java/atomicstryker/infernalmobs/common/mods/MM_Vengeance.java @@ -29,7 +29,7 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage) { reflectedDamage = Math.min(maxReflectDamage, reflectedDamage); } - source.getEntity().attackEntityFrom(DamageSource.causeMobDamage(mob), reflectedDamage); + source.getEntity().attackEntityFrom(DamageSource.causeThornsDamage(mob), reflectedDamage); } return super.onHurt(mob, source, damage);