Better API Handling for Scripting Energy Utilitizes / Damage Handling

This commit is contained in:
Kam committed 2026-03-03 02:02:05 -05:00
1 parent 7df1cfbfb9
commit 572a51ad32
10 files changed
+352 -2

No files matched your search

@@ -3,6 +3,7 @@ package kamkeel.npcs.entity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import kamkeel.npcs.controllers.AbilityController;
import kamkeel.npcs.controllers.EnergyController;
import kamkeel.npcs.controllers.data.ability.Ability;
import kamkeel.npcs.controllers.data.ability.data.energy.EnergyDisplayData;
import kamkeel.npcs.util.CNPCDebug;
@@ -322,6 +323,14 @@ public class EntityEnergySweeper extends EntityEnergyAbility {
sourceAbility, (EntityLivingBase) owner, target,
damage, 0.0f, 0.2f, dx, dz, 1.0f);
}
// Fallback: route through EnergyController for script-created entities with custom damage data
if (!handled && customDamageData != null && owner instanceof EntityLivingBase) {
double dx = target.posX - posX;
double dz = target.posZ - posZ;
handled = EnergyController.Instance.fireOnEnergyDamage(
this, (EntityLivingBase) owner, target,
damage, 0.0f, 0.2f, dx, dz, 1.0f, customDamageData);
}
if (!handled) {
if (owner instanceof EntityNPCInterface) {
@@ -394,6 +403,24 @@ public class EntityEnergySweeper extends EntityEnergyAbility {
return baseYaw;
}
// ==================== PUBLIC SETTERS (for EnergyController / scripting API) ====================
public void setBeamLength(float length) { this.beamLength = length; }
public void setBeamWidth(float width) { this.beamWidth = width; }
public void setBeamHeight(float height) { this.beamHeight = height; }
public float getDamage() { return damage; }
public void setDamage(float damage) { this.damage = damage; }
public int getDamageInterval() { return damageInterval; }
public void setDamageInterval(int interval) { this.damageInterval = interval; }
public boolean isPiercing() { return piercing; }
public void setPiercing(boolean piercing) { this.piercing = piercing; }
public float getSweepSpeed() { return sweepSpeed; }
public void setSweepSpeed(float speed) { this.sweepSpeed = speed; }
public int getNumberOfRotations() { return numberOfRotations; }
public void setNumberOfRotations(int rotations) { this.numberOfRotations = rotations; }
public boolean isLockOnTarget() { return lockOnTarget; }
public void setLockOnTarget(boolean lock) { this.lockOnTarget = lock; }
// ==================== NBT ====================
@Override