- Barrier Health Scaling with DBC Addon

- Healing Health Scaling with DBC Addon
- Ki Attacks collided with Barriers
- Remove Ability Slot (Deprecated)
- Refactored Naming Scheme for Barrier Abilities
- Fixed Player Settings for Ignore Dex, DBC Stats, etc.
This commit is contained in:
Kam committed 2026-02-21 14:40:14 -05:00
1 parent 3e58013ad6
commit ecfedff9d2
25 files changed
+201 -276

No files matched your search

@@ -22,24 +22,24 @@ import java.util.List;
* and barrier lifecycle management.
* Extends EntityEnergyAbility for shared visual/owner/charging state.
*/
public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
public abstract class EntityAbilityBarrier extends EntityEnergyAbility {
// ==================== ACTIVE BARRIER REGISTRY ====================
private static final List<WeakReference<EntityEnergyBarrier>> activeBarriers = new ArrayList<>();
private static final List<WeakReference<EntityAbilityBarrier>> activeBarriers = new ArrayList<>();
private boolean tracked = false;
public static void trackBarrier(EntityEnergyBarrier barrier) {
public static void trackBarrier(EntityAbilityBarrier barrier) {
activeBarriers.add(new WeakReference<>(barrier));
}
/**
* Get all living barriers in the given world. Auto-cleans dead refs.
*/
public static List<EntityEnergyBarrier> getActiveBarriers(World world) {
List<EntityEnergyBarrier> result = new ArrayList<>();
Iterator<WeakReference<EntityEnergyBarrier>> it = activeBarriers.iterator();
public static List<EntityAbilityBarrier> getActiveBarriers(World world) {
List<EntityAbilityBarrier> result = new ArrayList<>();
Iterator<WeakReference<EntityAbilityBarrier>> it = activeBarriers.iterator();
while (it.hasNext()) {
EntityEnergyBarrier b = it.next().get();
EntityAbilityBarrier b = it.next().get();
if (b == null || b.isDead) {
it.remove();
} else if (b.worldObj == world) {
@@ -62,7 +62,7 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
protected static final int DW_HEALTH_PERCENT = 21;
protected static final int DW_HIT_FLASH = 22;
public EntityEnergyBarrier(World world) {
public EntityAbilityBarrier(World world) {
super(world);
this.noClip = true;
}
@@ -358,10 +358,10 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
* Find a barrier that would absorb damage for the given entity (its caster).
* Returns the barrier if: absorbing is enabled AND entity is the barrier's owner.
*/
public static EntityEnergyBarrier getAbsorbingBarrier(Entity entity) {
public static EntityAbilityBarrier getAbsorbingBarrier(Entity entity) {
if (entity == null || entity.worldObj == null) return null;
List<EntityEnergyBarrier> barriers = getActiveBarriers(entity.worldObj);
for (EntityEnergyBarrier barrier : barriers) {
List<EntityAbilityBarrier> barriers = getActiveBarriers(entity.worldObj);
for (EntityAbilityBarrier barrier : barriers) {
if (barrier.isDead) continue;
if (!barrier.barrierData.absorbing) continue;
if (barrier.ownerEntityId == entity.getEntityId()) {
@@ -425,6 +425,16 @@ public abstract class EntityEnergyBarrier extends EntityEnergyAbility {
syncHealthPercent();
}
/**
* Override the barrier's max health and set current health to match.
* Used by extenders (e.g., DBC scaling) to dynamically set barrier HP at spawn time.
*/
public void setBarrierMaxHealth(float maxHealth) {
this.barrierData.setMaxHealth(maxHealth);
this.currentHealth = maxHealth;
syncHealthPercent();
}
public int getTicksAlive() {
return ticksAlive;
}
@@ -22,9 +22,9 @@ import java.util.List;
* Energy Dome entity - a spherical barrier that blocks incoming energy projectiles.
* Centered on the caster's position at time of casting.
* Only blocks incoming attacks (not outgoing from allies inside).
* Extends EntityEnergyBarrier for shared barrier logic.
* Extends EntityAbilityBarrier for shared barrier logic.
*/
public class EntityEnergyDome extends EntityEnergyBarrier {
public class EntityAbilityDome extends EntityAbilityBarrier {
// ==================== DOME-SPECIFIC PROPERTIES ====================
protected float domeRadius = 5.0f;
@@ -35,16 +35,16 @@ public class EntityEnergyDome extends EntityEnergyBarrier {
private boolean inTickMelee = false;
private final HashSet<Integer> processedMeleeSwings = new HashSet<>();
public EntityEnergyDome(World world) {
public EntityAbilityDome(World world) {
super(world);
this.noClip = true;
this.stepHeight = 0.0F;
this.setSize(1.0f, 1.0f);
}
public EntityEnergyDome(World world, EntityLivingBase owner, double x, double y, double z,
float domeRadius, EnergyDisplayData display, EnergyLightningData lightning,
EnergyBarrierData barrier) {
public EntityAbilityDome(World world, EntityLivingBase owner, double x, double y, double z,
float domeRadius, EnergyDisplayData display, EnergyLightningData lightning,
EnergyBarrierData barrier) {
this(world);
this.noClip = true;
this.stepHeight = 0.0F;
@@ -382,8 +382,8 @@ public class EntityAbilityLaser extends EntityEnergyProjectile {
protected boolean checkBarrierCollision() {
if (currentLength <= 0 || fullyExtended) return false;
List<EntityEnergyBarrier> barriers = EntityEnergyBarrier.getActiveBarriers(worldObj);
for (EntityEnergyBarrier barrier : barriers) {
List<EntityAbilityBarrier> barriers = EntityAbilityBarrier.getActiveBarriers(worldObj);
for (EntityAbilityBarrier barrier : barriers) {
if (barrier.isDead || barrier.isCharging()) continue;
if (barrier.getOwnerEntityId() == this.ownerEntityId) continue;
@@ -396,8 +396,8 @@ public class EntityAbilityLaser extends EntityEnergyProjectile {
}
}
if (barrier instanceof EntityEnergyDome) {
EntityEnergyDome dome = (EntityEnergyDome) barrier;
if (barrier instanceof EntityAbilityDome) {
EntityAbilityDome dome = (EntityAbilityDome) barrier;
float intersectDist = getLineSphereIntersection(dome);
if (intersectDist >= 0) {
// Truncate laser at dome surface
@@ -431,7 +431,7 @@ public class EntityAbilityLaser extends EntityEnergyProjectile {
* Returns the distance along the laser direction to the first entry point,
* or -1 if no intersection from outside.
*/
private float getLineSphereIntersection(EntityEnergyDome dome) {
private float getLineSphereIntersection(EntityAbilityDome dome) {
double cx = dome.posX;
double cy = dome.posY;
double cz = dome.posZ;
@@ -22,9 +22,9 @@ import java.util.List;
/**
* Energy Panel entity - a flat rectangular barrier used by Wall and Shield abilities.
* Supports three modes: PLACED (stationary), HELD (tracks caster), LAUNCHED (moves forward).
* Extends EntityEnergyBarrier for shared barrier logic.
* Extends EntityAbilityBarrier for shared barrier logic.
*/
public class EntityEnergyPanel extends EntityEnergyBarrier {
public class EntityAbilityPanel extends EntityAbilityBarrier {
public enum PanelMode {
PLACED, // Stationary wall
@@ -42,15 +42,15 @@ public class EntityEnergyPanel extends EntityEnergyBarrier {
protected float targetPanelWidth;
protected float targetPanelHeight;
public EntityEnergyPanel(World world) {
public EntityAbilityPanel(World world) {
super(world);
this.setSize(0.5f, 0.5f);
}
public EntityEnergyPanel(World world, EntityLivingBase owner, double x, double y, double z,
float yaw, PanelMode mode,
EnergyDisplayData display, EnergyLightningData lightning,
EnergyBarrierData barrier, EnergyPanelData panel) {
public EntityAbilityPanel(World world, EntityLivingBase owner, double x, double y, double z,
float yaw, PanelMode mode,
EnergyDisplayData display, EnergyLightningData lightning,
EnergyBarrierData barrier, EnergyPanelData panel) {
this(world);
this.setPosition(x, y + panel.heightOffset, z);
this.ownerEntityId = owner.getEntityId();
@@ -318,8 +318,8 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
* @return true if projectile was absorbed (caller should stop processing)
*/
protected boolean checkBarrierCollision() {
List<EntityEnergyBarrier> barriers = EntityEnergyBarrier.getActiveBarriers(worldObj);
for (EntityEnergyBarrier barrier : barriers) {
List<EntityAbilityBarrier> barriers = EntityAbilityBarrier.getActiveBarriers(worldObj);
for (EntityAbilityBarrier barrier : barriers) {
if (barrier.isDead) continue;
// Quick distance pre-filter