Fixed deflection stack overflow

This commit is contained in:
Auxilor 2021-02-03 08:30:57 +00:00
parent e55e7d8882
commit 7b1768f64c

View File

@ -20,6 +20,14 @@ public class Deflection extends EcoEnchant {
@NotNull final LivingEntity attacker,
final int level,
@NotNull final EntityDamageByEntityEvent event) {
if (blocker.hasMetadata("cleaved") || blocker.hasMetadata("carved")) {
return;
}
if (attacker.hasMetadata("cleaved") || attacker.hasMetadata("carved")) {
return;
}
double perlevel = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "percent-deflected-per-level");
double damagePercent = (perlevel / 100) * level;
double damage = event.getDamage() * damagePercent;