Fix Broken Charging Spamming

This commit is contained in:
Kam committed 2026-02-25 23:15:32 -05:00
1 parent 690336036d
commit 2e221b42a1
3 files changed
+25 -1

No files matched your search

@@ -21,6 +21,7 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
// ==================== SAFETY CONSTANTS ====================
protected static final int CHARGE_TIMEOUT_GRACE = 60; // Ticks of grace after charge should have ended
protected static final int PREVIEW_CHARGE_GRACE = 3; // Ticks of grace for client-only charge previews
protected static final int HARD_LIFETIME_CAP = 1200; // 60 seconds absolute max for projectiles/sweepers
protected static final int BARRIER_HARD_LIFETIME_CAP = 12000; // 10 minutes absolute max for barriers
protected static final float MAX_ENTITY_SIZE = 100.0f; // Max size/width/length for any energy entity
@@ -94,7 +95,7 @@ public abstract class EntityEnergyAbility extends Entity implements IEntityAddit
public float getInterpolatedChargeProgress(float partialTicks) {
if (chargeDuration <= 0) return 1.0f;
float prevProgress = Math.max(0, (float) (chargeTick - 1) / chargeDuration);
float prevProgress = Math.min(1.0f, Math.max(0, (float) (chargeTick - 1) / chargeDuration));
float currProgress = Math.min(1.0f, (float) chargeTick / chargeDuration);
return prevProgress + (currProgress - prevProgress) * partialTicks;
}