Add Absorbing Radius to Barriers

This commit is contained in:
Kam committed 2026-03-09 17:26:55 -04:00
1 parent 319e774518
commit 10f8cfdeaa
1 file changed
+62
@@ -57,10 +57,72 @@ public interface IEnergyBarrier<T extends Entity> extends IEnergyAbility<T> {
void setKnockbackStrength(float strength);
/**
* Returns whether this barrier absorbs damage on behalf of its owner.
* When absorbing is enabled, incoming damage to the barrier's owner is redirected
* to the barrier instead, subject to the absorb radius check.
*
* @return {@code true} if the barrier absorbs the owner's incoming damage
* @see #getAbsorbRadius()
*/
boolean isAbsorbing();
/**
* Sets whether this barrier absorbs damage on behalf of its owner.
* When absorbing is enabled, incoming damage to the barrier's owner is redirected
* to the barrier instead, subject to the absorb radius check.
*
* @param absorbing {@code true} to enable damage absorption for the owner
* @see #setAbsorbRadius(float)
*/
void setAbsorbing(boolean absorbing);
/**
* Gets the absorb radius for this barrier.
* The absorb radius determines the maximum distance from the barrier's current
* position at which the owner's incoming damage will still be redirected to the barrier.
* This check uses the barrier entity's live position, so it works correctly with
* moving barriers (following domes, moving walls, shields, etc.).
*
* <ul>
* <li>{@code -1} = No distance limit. Damage is always absorbed regardless of distance.</li>
* <li>{@code 0} = Uses the barrier's own geometric extent as the effective radius.
* <ul>
* <li>Domes: the dome radius (sphere radius in blocks).</li>
* <li>Panels: {@code (max(width, height) * 0.5 + 1.0) * 3}
* (i.e. {@code max(width, height) * 1.5 + 3.0} blocks).</li>
* </ul>
* </li>
* <li>Positive values = The owner must be within this many blocks of the barrier entity.</li>
* </ul>
*
* @return the absorb radius in blocks, or {@code -1} for unlimited, or {@code 0} for barrier extent
*/
float getAbsorbRadius();
/**
* Sets the absorb radius for this barrier.
* The absorb radius determines the maximum distance from the barrier's current
* position at which the owner's incoming damage will still be redirected to the barrier.
* This check uses the barrier entity's live position, so it works correctly with
* moving barriers (following domes, moving walls, shields, etc.).
*
* <ul>
* <li>{@code -1} = No distance limit. Damage is always absorbed regardless of distance.</li>
* <li>{@code 0} = Uses the barrier's own geometric extent as the effective radius.
* <ul>
* <li>Domes: the dome radius (sphere radius in blocks).</li>
* <li>Panels: {@code (max(width, height) * 0.5 + 1.0) * 3}
* (i.e. {@code max(width, height) * 1.5 + 3.0} blocks).</li>
* </ul>
* </li>
* <li>Positive values = The owner must be within this many blocks of the barrier entity.</li>
* </ul>
*
* @param radius the absorb radius in blocks, or {@code -1} for unlimited, or {@code 0} for barrier extent
*/
void setAbsorbRadius(float radius);
/**
* Returns the barrier type: 0=Dome, 1=Panel
* @return the barrier type ordinal