Add Max to Energy Entities to prevent any long-term issues / errors

This commit is contained in:
Kam committed 2026-02-19 02:14:34 -05:00
1 parent e330b517a8
commit 6fdf9daf24
21 files changed
+102 -48

No files matched your search

@@ -219,6 +219,18 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
}
}
// Charging timeout - if charge phase exceeded with grace period, force kill
if (isCharging() && chargeTick > chargeDuration + CHARGE_TIMEOUT_GRACE) {
this.setDead();
return;
}
// Absolute hard lifetime cap (safety net for any stuck state)
if (ticksExisted > HARD_LIFETIME_CAP) {
this.setDead();
return;
}
// Set death time on first tick if not already set (handles chunk load/unload)
// Skip during charging phase - lifetime starts when the entity actually fires
if (deathWorldTime < 0 && worldObj != null && !isCharging()) {
@@ -911,7 +923,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility {
protected void readBaseNBT(NBTTagCompound nbt) {
readEnergyBaseNBT(nbt);
this.size = nbt.getFloat("Size");
this.size = sanitize(nbt.getFloat("Size"), 1.0f, MAX_ENTITY_SIZE);
// Read effects list
this.effects.clear();