Scale melee damage dealt to barriers

Barriers are plain entities, so no LivingHurtEvent fires for them and nothing
scaled an incoming melee hit - vanilla handed over the bare attackDamage
attribute and a dome took one point per swing however strong the attacker was.
Attributes now apply, and modifyBarrierMeleeDamage gives addons the same seam
they already have for barrier health.
This commit is contained in:
KAMKEEL committed 2026-08-11 03:43:38 -04:00
1 parent 6477ede022
commit 4341c15cf4
3 files changed
+43 -1

No files matched your search

@@ -3,6 +3,7 @@ package kamkeel.npcs.controllers.data.ability.extender;
import kamkeel.npcs.controllers.data.ability.conditions.AbilityCondition;
import kamkeel.npcs.controllers.data.ability.enums.AbilityPhase;
import kamkeel.npcs.controllers.data.ability.Ability;
import kamkeel.npcs.entity.EntityEnergyBarrier;
import net.minecraft.entity.EntityLivingBase;
/**
@@ -108,6 +109,21 @@ public interface IAbilityExtender {
return baseHealth;
}
/**
* Called when a barrier entity takes a melee hit, allowing extenders to scale the damage.
* A barrier is a plain Entity, so no LivingHurtEvent fires for it and an extender has no
* other opportunity to scale melee against it the way it scales {@link #modifyBarrierHealth}.
* Cumulative: all extenders apply in sequence, each receiving the previous output.
*
* @param barrier The barrier being hit
* @param attacker The entity dealing the hit
* @param baseDamage The damage after the barrier's own melee multiplier
* @return The modified damage value
*/
default float modifyBarrierMeleeDamage(EntityEnergyBarrier barrier, EntityLivingBase attacker, float baseDamage) {
return baseDamage;
}
/**
* Called when an ability is about to heal an entity.
* Return true to handle the healing (skip default entity.heal()).