Damage-modifying power types will always play the hurt animation for players, regardless of if the specified damage condition is true or not
Closed this issue · 0 comments
eggohito commented
This issue is caused by using the PowerHolderComponent#getPowers
method in the PlayerEntityMixin.java
class, which does not provide a way of specifying a predicate to evaluate the the damage condition of the powers:
apoli/src/main/java/io/github/apace100/apoli/mixin/PlayerEntityMixin.java
Lines 146 to 155 in 1835a52
This issue can be fixed by using the PowerHolderComponent#hasPower
method and providing a predicate that would evaluate the damage condition of the powers instead:
if (source.getAttacker() != null) {
if(!source.isProjectile()) {
hasModifyingPower = PowerHolderComponent.hasPower(source.getAttacker(), ModifyDamageDealtPower.class, p -> p.doesApply(source, amount, this));
}
else {
hasModifyingPower = PowerHolderComponent.hasPower(source.getAttacker(), ModifyProjectileDamagePower.class, p -> p.doesApply(source, amount, this));
}
}
hasModifyingPower |= PowerHolderComponent.hasPower(this, ModifyDamageTakenPower.class, p -> p.doesApply(source, amount));