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

@@ -43,6 +43,14 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
* The ability that spawned this entity. Transient, not saved to NBT.
*/
protected transient Ability sourceAbility = null;
/**
* Custom damage data for script-created entities that don't have a sourceAbility.
* Used by EnergyController handlers (e.g. DBC Addon) to carry damage configuration
* directly on the entity. Persistent — saved to spawn data for client sync.
*/
protected NBTTagCompound customDamageData = null;
protected boolean ignoreIFrames = false;
protected boolean previewMode = false;
protected EntityLivingBase previewOwner = null;
@@ -141,6 +149,16 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
this.sourceAbility = ability;
}
// ==================== CUSTOM DAMAGE DATA ====================
public NBTTagCompound getCustomDamageData() {
return customDamageData;
}
public void setCustomDamageData(NBTTagCompound data) {
this.customDamageData = data;
}
public boolean isIgnoreIFrames() {
return ignoreIFrames;
}
@@ -325,6 +343,9 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
nbt.setBoolean("IgnoreIFrames", ignoreIFrames);
displayData.writeNBT(nbt);
lightningData.writeNBT(nbt);
if (customDamageData != null) {
nbt.setTag("CustomDamageData", customDamageData);
}
}
/**
@@ -336,6 +357,9 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
this.ignoreIFrames = nbt.getBoolean("IgnoreIFrames");
displayData.readNBT(nbt);
lightningData.readNBT(nbt);
if (nbt.hasKey("CustomDamageData")) {
this.customDamageData = nbt.getCompoundTag("CustomDamageData");
}
}
// ==================== SPAWN DATA ====================