Refactored effect

This commit is contained in:
2026-03-20 21:36:04 +01:00
parent edb37d0307
commit 44c5a1783f
2 changed files with 7 additions and 27 deletions
@@ -2,8 +2,8 @@ package org.saturnclient.common.module;
import java.util.List; import java.util.List;
import org.saturnclient.common.ref.game.EffectRef;
import org.saturnclient.common.ref.game.ItemStackRef; import org.saturnclient.common.ref.game.ItemStackRef;
import org.saturnclient.feature.features.StatusEffectsFeature;
/** /**
* PlayerModule provides access to the state of the local player. * PlayerModule provides access to the state of the local player.
@@ -93,13 +93,13 @@ public interface PlayerModule {
* Returns a list of the player’s currently active effects. * Returns a list of the player’s currently active effects.
* Safe default: empty list if no player is present. * Safe default: empty list if no player is present.
*/ */
List<? extends StatusEffectsFeature.EffectView> getActiveEffects(); List<? extends EffectRef> getActiveEffects();
/** /**
* Returns a list of dummy effects used in HUD editor / preview mode. * Returns a list of dummy effects used in HUD editor / preview mode.
* Safe default: empty list. * Safe default: empty list.
*/ */
List<? extends StatusEffectsFeature.EffectView> getDummyEffects(); List<? extends EffectRef> getDummyEffects();
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Inventory / equipment // Inventory / equipment
@@ -4,7 +4,7 @@ import java.util.List;
import org.saturnclient.common.provider.ModuleProvider; import org.saturnclient.common.provider.ModuleProvider;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
import org.saturnclient.common.ref.asset.SpriteRef; import org.saturnclient.common.ref.game.EffectRef;
import org.saturnclient.config.property.BoolProperty; import org.saturnclient.config.property.BoolProperty;
import org.saturnclient.config.property.Property; import org.saturnclient.config.property.Property;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
@@ -37,26 +37,6 @@ public class StatusEffectsFeature extends Feature implements HudFeature {
layout.prop()); layout.prop());
} }
// ---------------------------------------------------------------
// Effect data contract (inner interface keeps things self-contained)
// ---------------------------------------------------------------
/**
* Minimal view of a single active status effect.
* Implementations are provided by the platform bridge.
*/
public interface EffectView {
boolean shouldShowIcon();
SpriteRef getIcon();
boolean isInfinite();
String getInfiniteText();
int getDurationSeconds();
}
// --------------------------------------------------------------- // ---------------------------------------------------------------
// HudFeature // HudFeature
// --------------------------------------------------------------- // ---------------------------------------------------------------
@@ -75,10 +55,10 @@ public class StatusEffectsFeature extends Feature implements HudFeature {
// Rendering // Rendering
// --------------------------------------------------------------- // ---------------------------------------------------------------
private void renderEffects(RenderScope scope, List<? extends EffectView> effects) { private void renderEffects(RenderScope scope, List<? extends EffectRef> effects) {
int row = 0; int row = 0;
for (EffectView effect : effects) { for (EffectRef effect : effects) {
if (!effect.shouldShowIcon()) if (!effect.shouldShowIcon())
continue; continue;
@@ -92,7 +72,7 @@ public class StatusEffectsFeature extends Feature implements HudFeature {
layout.height = 18 * row; layout.height = 18 * row;
} }
private static String durationString(EffectView effect) { private static String durationString(EffectRef effect) {
if (effect.isInfinite()) if (effect.isInfinite())
return effect.getInfiniteText(); return effect.getInfiniteText();