Skip to content

Commit

Permalink
Merge pull request #7 from D-Cysteine/1.7.10
Browse files Browse the repository at this point in the history
Limit vengeance reflection to mob's current health
  • Loading branch information
Dream-Master committed Nov 20, 2021
2 parents 461f970 + 187d866 commit 48b95ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
minecraft.version=1.7.10
forge.version=10.13.4.1614-1.7.10
mod.version=1.7.2-GTNH
mod.version=1.7.3-GTNH
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ public float onHurt(EntityLivingBase mob, DamageSource source, float damage)
{
if (source.getEntity() != null && source.getEntity() != mob && !InfernalMobsCore.instance().isInfiniteLoop(mob, source.getEntity()))
{
if (maxReflectDamage <= 0.0f)
float reflectedDamage = Math.min(mob.getHealth(), Math.max(damage * reflectMultiplier, 1));
if (maxReflectDamage > 0.0f)
{
source.getEntity().attackEntityFrom(DamageSource.causeMobDamage(mob), Math.max(damage * reflectMultiplier, 1));
}
else
{
source.getEntity().attackEntityFrom(DamageSource.causeMobDamage(mob),
Math.min(maxReflectDamage, Math.max(damage * reflectMultiplier, 1)));
reflectedDamage = Math.min(maxReflectDamage, reflectedDamage);
}
source.getEntity().attackEntityFrom(DamageSource.causeMobDamage(mob), reflectedDamage);
}

return super.onHurt(mob, source, damage);
Expand Down

0 comments on commit 48b95ba

Please sign in to comment.