Refactored Feature to Mod

This commit is contained in:
2026-03-24 11:48:04 +01:00
parent 174c95240c
commit 3138f7ec62
28 changed files with 196 additions and 196 deletions
@@ -1,9 +1,9 @@
package org.saturnclient.feature; package org.saturnclient.mod;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
public interface HudFeature { public interface HudMod {
public FeatureLayout getDimensions(); public ModLayout getDimensions();
public void renderDummy(RenderScope scope); public void renderDummy(RenderScope scope);
@@ -1,4 +1,4 @@
package org.saturnclient.feature; package org.saturnclient.mod;
import org.saturnclient.common.ref.asset.IdentifierRef; import org.saturnclient.common.ref.asset.IdentifierRef;
import org.saturnclient.config.ConfigManager; import org.saturnclient.config.ConfigManager;
@@ -6,11 +6,11 @@ import org.saturnclient.config.property.NamedProperty;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Textures; import org.saturnclient.ui.resources.Textures;
public abstract class Feature { public abstract class Mod {
private final FeatureDetails details; private final ModSpec details;
private final ConfigManager configManager; private final ConfigManager configManager;
public Feature(FeatureDetails details, NamedProperty... props) { public Mod(ModSpec details, NamedProperty... props) {
this.details = details; this.details = details;
configManager = new ConfigManager(details.name); configManager = new ConfigManager(details.name);
for (NamedProperty prop : props) { for (NamedProperty prop : props) {
@@ -28,7 +28,7 @@ public abstract class Feature {
public final void setEnabled(boolean e) { public final void setEnabled(boolean e) {
onEnabled(e); onEnabled(e);
FeatureManager.updateEnabledModules(); ModManager.updateEnabledModules();
} }
public abstract void onEnabled(boolean e); public abstract void onEnabled(boolean e);
@@ -1,4 +1,4 @@
package org.saturnclient.feature; package org.saturnclient.mod;
import java.util.Map; import java.util.Map;
@@ -9,7 +9,7 @@ import org.saturnclient.config.property.FloatProperty;
import org.saturnclient.config.property.IntProperty; import org.saturnclient.config.property.IntProperty;
import org.saturnclient.config.property.NamedProperty; import org.saturnclient.config.property.NamedProperty;
public class FeatureLayout { public class ModLayout {
public IntProperty x = Property.integer(0); public IntProperty x = Property.integer(0);
public IntProperty y = Property.integer(0); public IntProperty y = Property.integer(0);
public FloatProperty scale = Property.floatProp(1.0f); public FloatProperty scale = Property.floatProp(1.0f);
@@ -33,22 +33,22 @@ public class FeatureLayout {
"Font", font)).named("In-Game Display"); "Font", font)).named("In-Game Display");
} }
public FeatureLayout() { public ModLayout() {
} }
public FeatureLayout(int width, int height) { public ModLayout(int width, int height) {
this.width = width; this.width = width;
this.height = height; this.height = height;
} }
public FeatureLayout(int x, int y, int width, int height) { public ModLayout(int x, int y, int width, int height) {
this.x.value = x; this.x.value = x;
this.y.value = y; this.y.value = y;
this.width = width; this.width = width;
this.height = height; this.height = height;
} }
public FeatureLayout(int x, int y, int width, int height, float scale) { public ModLayout(int x, int y, int width, int height, float scale) {
this.x.value = x; this.x.value = x;
this.y.value = y; this.y.value = y;
this.scale.value = scale; this.scale.value = scale;
@@ -1,13 +1,13 @@
package org.saturnclient.feature; package org.saturnclient.mod;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.saturnclient.feature.features.*; import org.saturnclient.mod.mods.*;
public class FeatureManager { public class ModManager {
public static List<Feature> ENABLED_MODS = new ArrayList<>(); public static List<Mod> ENABLED_MODS = new ArrayList<>();
public static Feature[] MODS = { public static Mod[] MODS = {
new ArmorDisplayFeature(), new DayCounterFeature(), new KeystrokesFeature(), new StatusEffectsFeature(), new ArmorDisplayFeature(), new DayCounterFeature(), new KeystrokesFeature(), new StatusEffectsFeature(),
new AutoSprintFeature(), new FpsFeature(), new NametagsFeature(), new TpsFeature(), new AutoSprintFeature(), new FpsFeature(), new NametagsFeature(), new TpsFeature(),
new ClockFeature(), new FreelookFeature(), new NoFogFeature(), new ZoomFeature(), new ClockFeature(), new FreelookFeature(), new NoFogFeature(), new ZoomFeature(),
@@ -21,7 +21,7 @@ public class FeatureManager {
public static synchronized void updateEnabledModules() { public static synchronized void updateEnabledModules() {
ENABLED_MODS.clear(); ENABLED_MODS.clear();
for (Feature m : MODS) { for (Mod m : MODS) {
if (m.isEnabled()) { if (m.isEnabled()) {
ENABLED_MODS.add(m); ENABLED_MODS.add(m);
} }
@@ -1,38 +1,38 @@
package org.saturnclient.feature; package org.saturnclient.mod;
public class FeatureDetails { public class ModSpec {
public String name; public String name;
public String namespace; public String namespace;
public String description; public String description;
public String version; public String version;
public String[] tags = {}; public String[] tags = {};
public FeatureDetails(String name, String namespace) { public ModSpec(String name, String namespace) {
this.name = name; this.name = name;
this.namespace = namespace; this.namespace = namespace;
} }
public FeatureDetails name(String name) { public ModSpec name(String name) {
this.name = name; this.name = name;
return this; return this;
} }
public FeatureDetails namespace(String namespace) { public ModSpec namespace(String namespace) {
this.namespace = namespace; this.namespace = namespace;
return this; return this;
} }
public FeatureDetails description(String description) { public ModSpec description(String description) {
this.description = description; this.description = description;
return this; return this;
} }
public FeatureDetails version(String version) { public ModSpec version(String version) {
this.version = version; this.version = version;
return this; return this;
} }
public FeatureDetails tags(String... tags) { public ModSpec tags(String... tags) {
this.tags = tags; this.tags = tags;
return this; return this;
} }
@@ -1,14 +1,14 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
import org.saturnclient.common.module.PlayerModule; import org.saturnclient.common.module.PlayerModule;
import org.saturnclient.common.ref.game.ItemStackRef; import org.saturnclient.common.ref.game.ItemStackRef;
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.feature.Feature; import org.saturnclient.mod.HudMod;
import org.saturnclient.feature.FeatureDetails; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureLayout; import org.saturnclient.mod.ModLayout;
import org.saturnclient.feature.HudFeature; import org.saturnclient.mod.ModSpec;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
/** /**
@@ -17,15 +17,15 @@ import org.saturnclient.ui.RenderScope;
* *
* Engine access is provided exclusively through {@link ModuleProvider}. * Engine access is provided exclusively through {@link ModuleProvider}.
*/ */
public class ArmorDisplayFeature extends Feature implements HudFeature { public class ArmorDisplayFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final BoolProperty useMainHand = Property.bool(true); private static final BoolProperty useMainHand = Property.bool(true);
private static final FeatureLayout layout = new FeatureLayout(40, 75); private static final ModLayout layout = new ModLayout(40, 75);
public ArmorDisplayFeature() { public ArmorDisplayFeature() {
super( super(
new FeatureDetails("Armor Display", "armor") new ModSpec("Armor Display", "armor")
.description("Displays armor durability") .description("Displays armor durability")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -107,7 +107,7 @@ public class ArmorDisplayFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,24 +1,24 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.mod.Mod;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.common.module.NetworkModule; import org.saturnclient.common.module.NetworkModule;
import org.saturnclient.common.module.PlayerModule; import org.saturnclient.common.module.PlayerModule;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
/** /**
* AutoSprintFeature automatically enables sprinting whenever the * AutoSprintFeature automatically enables sprinting whenever the
* player moves forward and no sprint-blocking condition is active. * player moves forward and no sprint-blocking condition is active.
*/ */
public class AutoSprintFeature extends Feature { public class AutoSprintFeature extends Mod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
public AutoSprintFeature() { public AutoSprintFeature() {
super( super(
new FeatureDetails("Auto Sprint", "sprint") new ModSpec("Auto Sprint", "sprint")
.description("Makes the player always sprint") .description("Makes the player always sprint")
.tags("Movement") .tags("Movement")
.version("v0.2.0"), .version("v0.2.0"),
@@ -1,4 +1,4 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@@ -8,25 +8,25 @@ import org.saturnclient.ui.resources.Fonts;
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.config.property.SelectProperty; import org.saturnclient.config.property.SelectProperty;
import org.saturnclient.feature.Feature; import org.saturnclient.mod.HudMod;
import org.saturnclient.feature.FeatureDetails; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureLayout; import org.saturnclient.mod.ModLayout;
import org.saturnclient.feature.HudFeature; import org.saturnclient.mod.ModSpec;
/** /**
* ClockFeature displays the real-world time as a HUD element. * ClockFeature displays the real-world time as a HUD element.
* No engine access is required; {@link LocalTime} is used directly. * No engine access is required; {@link LocalTime} is used directly.
*/ */
public class ClockFeature extends Feature implements HudFeature { public class ClockFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final SelectProperty format = Property.select(0, "24 hour", "12 hour"); private static final SelectProperty format = Property.select(0, "24 hour", "12 hour");
private static final BoolProperty showSeconds = Property.bool(false); private static final BoolProperty showSeconds = Property.bool(false);
private static final FeatureLayout layout = new FeatureLayout(60, Fonts.getHeight()); private static final ModLayout layout = new ModLayout(60, Fonts.getHeight());
public ClockFeature() { public ClockFeature() {
super( super(
new FeatureDetails("Clock", "clock") new ModSpec("Clock", "clock")
.description("Displays the current real-world time") .description("Displays the current real-world time")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -78,7 +78,7 @@ public class ClockFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,21 +1,21 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.config.property.SelectProperty; import org.saturnclient.config.property.SelectProperty;
import org.saturnclient.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Fonts; import org.saturnclient.ui.resources.Fonts;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* CoordinatesFeature displays the player's current XYZ position as a * CoordinatesFeature displays the player's current XYZ position as a
* HUD element with multiple configurable display formats. * HUD element with multiple configurable display formats.
*/ */
public class CoordinatesFeature extends Feature implements HudFeature { public class CoordinatesFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final SelectProperty displayMethod = Property.select(0, private static final SelectProperty displayMethod = Property.select(0,
@@ -23,11 +23,11 @@ public class CoordinatesFeature extends Feature implements HudFeature {
"Flat annotated", "Flat annotated",
"Newline", "Newline",
"Newline annotated"); "Newline annotated");
private static final FeatureLayout layout = new FeatureLayout(40, 18); private static final ModLayout layout = new ModLayout(40, 18);
public CoordinatesFeature() { public CoordinatesFeature() {
super( super(
new FeatureDetails("Coordinates", "coords") new ModSpec("Coordinates", "coords")
.description("Displays your current coordinates") .description("Displays your current coordinates")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -78,7 +78,7 @@ public class CoordinatesFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,19 +1,19 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.mod.Mod;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.common.module.RenderModule; import org.saturnclient.common.module.RenderModule;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Textures; import org.saturnclient.ui.resources.Textures;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
/** /**
* CrosshairFeature renders an alternative crosshair texture when the * CrosshairFeature renders an alternative crosshair texture when the
* player is aiming at a living entity. * player is aiming at a living entity.
*/ */
public class CrosshairFeature extends Feature { public class CrosshairFeature extends Mod {
public static final BoolProperty enabled = Property.bool(false); public static final BoolProperty enabled = Property.bool(false);
@@ -21,7 +21,7 @@ public class CrosshairFeature extends Feature {
public CrosshairFeature() { public CrosshairFeature() {
super( super(
new FeatureDetails("Crosshair", "crosshair") new ModSpec("Crosshair", "crosshair")
.description("Changes the crosshair when aiming at an entity") .description("Changes the crosshair when aiming at an entity")
.tags("Visuals", "Utility") .tags("Visuals", "Utility")
.version("v0.2.0"), .version("v0.2.0"),
@@ -1,28 +1,28 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.module.WorldModule; import org.saturnclient.common.module.WorldModule;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Fonts; import org.saturnclient.ui.resources.Fonts;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* DayCounterFeature shows how many in-game days have elapsed. * DayCounterFeature shows how many in-game days have elapsed.
* Day count is derived from the world age via {@link WorldModule}. * Day count is derived from the world age via {@link WorldModule}.
*/ */
public class DayCounterFeature extends Feature implements HudFeature { public class DayCounterFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final FeatureLayout layout = new FeatureLayout(40, 18); private static final ModLayout layout = new ModLayout(40, 18);
public DayCounterFeature() { public DayCounterFeature() {
super( super(
new FeatureDetails("Day Counter", "day") new ModSpec("Day Counter", "day")
.description("Displays the number of in-game days elapsed") .description("Displays the number of in-game days elapsed")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -61,7 +61,7 @@ public class DayCounterFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,28 +1,28 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.module.RenderModule; import org.saturnclient.common.module.RenderModule;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Fonts; import org.saturnclient.ui.resources.Fonts;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* FpsFeature displays the current frames-per-second as a HUD element. * FpsFeature displays the current frames-per-second as a HUD element.
* FPS is obtained from {@link RenderModule} rather than cached in the feature. * FPS is obtained from {@link RenderModule} rather than cached in the feature.
*/ */
public class FpsFeature extends Feature implements HudFeature { public class FpsFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final FeatureLayout layout = new FeatureLayout(60, Fonts.getHeight()); private static final ModLayout layout = new ModLayout(60, Fonts.getHeight());
public FpsFeature() { public FpsFeature() {
super( super(
new FeatureDetails("FPS Display", "fps") new ModSpec("FPS Display", "fps")
.description("Displays current FPS") .description("Displays current FPS")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -59,7 +59,7 @@ public class FpsFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,13 +1,13 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
import org.saturnclient.config.property.BoolProperty; import org.saturnclient.config.property.BoolProperty;
import org.saturnclient.config.property.KeybindingProperty; import org.saturnclient.config.property.KeybindingProperty;
import org.saturnclient.config.property.Property; import org.saturnclient.config.property.Property;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.common.module.RenderModule; import org.saturnclient.common.module.RenderModule;
import org.saturnclient.common.provider.GLFWProvider; import org.saturnclient.common.provider.GLFWProvider;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
/** /**
* FreelookFeature lets the player look around freely (in third-person) * FreelookFeature lets the player look around freely (in third-person)
@@ -16,7 +16,7 @@ import org.saturnclient.feature.FeatureDetails;
* Camera perspective is controlled through {@link RenderModule} so * Camera perspective is controlled through {@link RenderModule} so
* that the feature itself contains no direct Minecraft API calls. * that the feature itself contains no direct Minecraft API calls.
*/ */
public class FreelookFeature extends Feature { public class FreelookFeature extends Mod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final BoolProperty toggle = Property.bool(true); private static final BoolProperty toggle = Property.bool(true);
@@ -28,7 +28,7 @@ public class FreelookFeature extends Feature {
public FreelookFeature() { public FreelookFeature() {
super( super(
new FeatureDetails("Freelook", "freelook") new ModSpec("Freelook", "freelook")
.description("Look around freely without moving your character") .description("Look around freely without moving your character")
.tags("Movement", "Camera") .tags("Movement", "Camera")
.version("v0.2.0"), .version("v0.2.0"),
@@ -1,10 +1,10 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.config.property.BoolProperty; import org.saturnclient.config.property.BoolProperty;
import org.saturnclient.config.property.IntProperty; import org.saturnclient.config.property.IntProperty;
import org.saturnclient.config.property.Property; import org.saturnclient.config.property.Property;
import org.saturnclient.feature.Feature; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureDetails; import org.saturnclient.mod.ModSpec;
/** /**
* FullbrightFeature overrides the game's gamma/brightness to let the * FullbrightFeature overrides the game's gamma/brightness to let the
@@ -16,14 +16,14 @@ import org.saturnclient.feature.FeatureDetails;
* No ModuleProvider is needed — this feature has no per-tick engine * No ModuleProvider is needed — this feature has no per-tick engine
* interaction; the mixin polls the static helpers directly. * interaction; the mixin polls the static helpers directly.
*/ */
public class FullbrightFeature extends Feature { public class FullbrightFeature extends Mod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final IntProperty brightness = Property.integer(100); private static final IntProperty brightness = Property.integer(100);
public FullbrightFeature() { public FullbrightFeature() {
super( super(
new FeatureDetails("Fullbright", "fullbright") new ModSpec("Fullbright", "fullbright")
.description("Allows you to see in the dark") .description("Allows you to see in the dark")
.tags("Camera") .tags("Camera")
.version("v0.2.0"), .version("v0.2.0"),
@@ -1,31 +1,31 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.config.property.SelectProperty; import org.saturnclient.config.property.SelectProperty;
import org.saturnclient.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Fonts; import org.saturnclient.ui.resources.Fonts;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* HealthDisplayFeature renders the player's current health as a HUD * HealthDisplayFeature renders the player's current health as a HUD
* element, with configurable display modes (raw health vs. hearts) and * element, with configurable display modes (raw health vs. hearts) and
* decimal precision. * decimal precision.
*/ */
public class HealthDisplayFeature extends Feature implements HudFeature { public class HealthDisplayFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final SelectProperty displayMode = Property.select(0, "Health", "Hearts"); private static final SelectProperty displayMode = Property.select(0, "Health", "Hearts");
private static final SelectProperty decimals = Property.select(0, "0", "1", "2"); private static final SelectProperty decimals = Property.select(0, "0", "1", "2");
private static final FeatureLayout layout = new FeatureLayout(40, 18); private static final ModLayout layout = new ModLayout(40, 18);
public HealthDisplayFeature() { public HealthDisplayFeature() {
super( super(
new FeatureDetails("Health Display", "health") new ModSpec("Health Display", "health")
.description("Displays your current health") .description("Displays your current health")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -75,7 +75,7 @@ public class HealthDisplayFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,21 +1,21 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
import org.saturnclient.config.property.BoolProperty; import org.saturnclient.config.property.BoolProperty;
import org.saturnclient.config.property.ColorProperty; import org.saturnclient.config.property.ColorProperty;
import org.saturnclient.config.property.Property; import org.saturnclient.config.property.Property;
import org.saturnclient.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.common.module.PlayerModule; import org.saturnclient.common.module.PlayerModule;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* KeystrokesFeature renders the WASD / mouse / space key states as an * KeystrokesFeature renders the WASD / mouse / space key states as an
* on-screen overlay. * on-screen overlay.
*/ */
public class KeystrokesFeature extends Feature implements HudFeature { public class KeystrokesFeature extends Mod implements HudMod {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Configuration // Configuration
@@ -28,7 +28,7 @@ public class KeystrokesFeature extends Feature implements HudFeature {
private static final ColorProperty clickBg = Property.color(0xFFCCCCCC); private static final ColorProperty clickBg = Property.color(0xFFCCCCCC);
private static final ColorProperty clickFg = Property.color(0xFFFFFFFF); private static final ColorProperty clickFg = Property.color(0xFFFFFFFF);
private static final FeatureLayout layout = new FeatureLayout(78, 54); private static final ModLayout layout = new ModLayout(78, 54);
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Layout constants // Layout constants
@@ -48,7 +48,7 @@ public class KeystrokesFeature extends Feature implements HudFeature {
public KeystrokesFeature() { public KeystrokesFeature() {
super( super(
new FeatureDetails("Keystrokes", "keystrokes") new ModSpec("Keystrokes", "keystrokes")
.description("Displays movement keystrokes") .description("Displays movement keystrokes")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -89,7 +89,7 @@ public class KeystrokesFeature extends Feature implements HudFeature {
} }
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,11 +1,11 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.module.EntityModule; import org.saturnclient.common.module.EntityModule;
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.config.property.SelectProperty; import org.saturnclient.config.property.SelectProperty;
import org.saturnclient.feature.Feature; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureDetails; import org.saturnclient.mod.ModSpec;
/** /**
* NametagsFeature modifies the nametags displayed above entities. * NametagsFeature modifies the nametags displayed above entities.
@@ -18,7 +18,7 @@ import org.saturnclient.feature.FeatureDetails;
* No ModuleProvider is required here because the mixin passes the * No ModuleProvider is required here because the mixin passes the
* already-resolved {@link EntityModule.EntityState} directly. * already-resolved {@link EntityModule.EntityState} directly.
*/ */
public class NametagsFeature extends Feature { public class NametagsFeature extends Mod {
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Configuration // Configuration
@@ -53,7 +53,7 @@ public class NametagsFeature extends Feature {
public NametagsFeature() { public NametagsFeature() {
super( super(
new FeatureDetails("Nametags", "nametags") new ModSpec("Nametags", "nametags")
.description("Allows you to modify entity nametags") .description("Allows you to modify entity nametags")
.tags("Camera", "Utility") .tags("Camera", "Utility")
.version("v0.2.0"), .version("v0.2.0"),
@@ -1,9 +1,9 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
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.feature.Feature; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureDetails; import org.saturnclient.mod.ModSpec;
/** /**
* NoFogFeature suppresses distance fog and (optionally) liquid fog. * NoFogFeature suppresses distance fog and (optionally) liquid fog.
@@ -12,13 +12,13 @@ import org.saturnclient.feature.FeatureDetails;
* inside a mixin. This class owns the configuration and provides * inside a mixin. This class owns the configuration and provides
* static query methods the mixin calls. * static query methods the mixin calls.
*/ */
public class NoFogFeature extends Feature { public class NoFogFeature extends Mod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
public NoFogFeature() { public NoFogFeature() {
super( super(
new FeatureDetails("No Fog", "nofog") new ModSpec("No Fog", "nofog")
.description("Stops fog from rendering") .description("Stops fog from rendering")
.tags("Camera") .tags("Camera")
.version("v0.2.0"), .version("v0.2.0"),
@@ -1,27 +1,27 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Fonts; import org.saturnclient.ui.resources.Fonts;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* PingFeature displays the current server round-trip time in * PingFeature displays the current server round-trip time in
* milliseconds as a HUD element. * milliseconds as a HUD element.
*/ */
public class PingFeature extends Feature implements HudFeature { public class PingFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final FeatureLayout layout = new FeatureLayout(60, Fonts.getHeight()); private static final ModLayout layout = new ModLayout(60, Fonts.getHeight());
public PingFeature() { public PingFeature() {
super( super(
new FeatureDetails("Ping Display", "ping") new ModSpec("Ping Display", "ping")
.description("Displays ping to the server") .description("Displays ping to the server")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -58,7 +58,7 @@ public class PingFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,34 +1,34 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
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.config.property.SelectProperty; import org.saturnclient.config.property.SelectProperty;
import org.saturnclient.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.common.module.PlayerModule; import org.saturnclient.common.module.PlayerModule;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Fonts; import org.saturnclient.ui.resources.Fonts;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* SpeedometerFeature displays the player's current movement speed as * SpeedometerFeature displays the player's current movement speed as
* a HUD element. Velocity data comes from {@link PlayerModule}. * a HUD element. Velocity data comes from {@link PlayerModule}.
*/ */
public class SpeedometerFeature extends Feature implements HudFeature { public class SpeedometerFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final SelectProperty axis = Property.select(1, "Absolute", "Horizontal", "Vertical"); private static final SelectProperty axis = Property.select(1, "Absolute", "Horizontal", "Vertical");
private static final SelectProperty unitText = Property.select(0, "None", "Blocks/s", "blocks/s", "b/s"); private static final SelectProperty unitText = Property.select(0, "None", "Blocks/s", "blocks/s", "b/s");
private static final BoolProperty showLabel = Property.bool(true); private static final BoolProperty showLabel = Property.bool(true);
private static final FeatureLayout layout = new FeatureLayout(40, 18); private static final ModLayout layout = new ModLayout(40, 18);
private double cachedSpeed = 0.0; private double cachedSpeed = 0.0;
public SpeedometerFeature() { public SpeedometerFeature() {
super( super(
new FeatureDetails("Speedometer", "speed") new ModSpec("Speedometer", "speed")
.description("Displays your current movement speed") .description("Displays your current movement speed")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -93,7 +93,7 @@ public class SpeedometerFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,4 +1,4 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import java.util.List; import java.util.List;
@@ -7,11 +7,11 @@ import org.saturnclient.common.provider.Providers;
import org.saturnclient.common.ref.game.EffectRef; 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.mod.HudMod;
import org.saturnclient.mod.Mod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.mod.ModSpec;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.feature.Feature;
import org.saturnclient.feature.FeatureDetails;
import org.saturnclient.feature.FeatureLayout;
import org.saturnclient.feature.HudFeature;
/** /**
* StatusEffectsFeature displays the player's active potion effects as * StatusEffectsFeature displays the player's active potion effects as
@@ -22,14 +22,14 @@ import org.saturnclient.feature.HudFeature;
* Until that is wired up, the existing {@link StatusEffectsInterface} * Until that is wired up, the existing {@link StatusEffectsInterface}
* bridge is used, accessed via {@link ModuleProvider}. * bridge is used, accessed via {@link ModuleProvider}.
*/ */
public class StatusEffectsFeature extends Feature implements HudFeature { public class StatusEffectsFeature extends Mod implements HudMod {
public static final BoolProperty enabled = Property.bool(false); public static final BoolProperty enabled = Property.bool(false);
private static final FeatureLayout layout = new FeatureLayout(60, 0); private static final ModLayout layout = new ModLayout(60, 0);
public StatusEffectsFeature() { public StatusEffectsFeature() {
super( super(
new FeatureDetails("Status Effects", "effect") new ModSpec("Status Effects", "effect")
.description("Displays active status effects") .description("Displays active status effects")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -91,7 +91,7 @@ public class StatusEffectsFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,13 +1,13 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.resources.Fonts; import org.saturnclient.ui.resources.Fonts;
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.feature.Feature; import org.saturnclient.mod.HudMod;
import org.saturnclient.feature.FeatureDetails; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureLayout; import org.saturnclient.mod.ModLayout;
import org.saturnclient.feature.HudFeature; import org.saturnclient.mod.ModSpec;
/** /**
* TpsFeature estimates the server's ticks-per-second by measuring the * TpsFeature estimates the server's ticks-per-second by measuring the
@@ -18,10 +18,10 @@ import org.saturnclient.feature.HudFeature;
* arrives. No ModuleProvider is required because there is no * arrives. No ModuleProvider is required because there is no
* per-frame polling of the engine. * per-frame polling of the engine.
*/ */
public class TpsFeature extends Feature implements HudFeature { public class TpsFeature extends Mod implements HudMod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final FeatureLayout layout = new FeatureLayout(60, Fonts.getHeight()); private static final ModLayout layout = new ModLayout(60, Fonts.getHeight());
// --------------------------------------------------------------- // ---------------------------------------------------------------
// TPS sampling state (static — shared across all instances) // TPS sampling state (static — shared across all instances)
@@ -46,7 +46,7 @@ public class TpsFeature extends Feature implements HudFeature {
public TpsFeature() { public TpsFeature() {
super( super(
new FeatureDetails("TPS Display", "tps") new ModSpec("TPS Display", "tps")
.description("Displays the server's ticks per second") .description("Displays the server's ticks per second")
.version("v0.2.0") .version("v0.2.0")
.tags("Utility"), .tags("Utility"),
@@ -126,7 +126,7 @@ public class TpsFeature extends Feature implements HudFeature {
// --------------------------------------------------------------- // ---------------------------------------------------------------
@Override @Override
public FeatureLayout getDimensions() { public ModLayout getDimensions() {
return layout; return layout;
} }
@@ -1,12 +1,12 @@
package org.saturnclient.feature.features; package org.saturnclient.mod.mods;
import org.saturnclient.common.provider.GLFWProvider; import org.saturnclient.common.provider.GLFWProvider;
import org.saturnclient.config.property.BoolProperty; import org.saturnclient.config.property.BoolProperty;
import org.saturnclient.config.property.FloatProperty; import org.saturnclient.config.property.FloatProperty;
import org.saturnclient.config.property.KeybindingProperty; import org.saturnclient.config.property.KeybindingProperty;
import org.saturnclient.config.property.Property; import org.saturnclient.config.property.Property;
import org.saturnclient.feature.Feature; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureDetails; import org.saturnclient.mod.ModSpec;
/** /**
* ZoomFeature multiplies the camera's field-of-view to create an * ZoomFeature multiplies the camera's field-of-view to create an
@@ -16,7 +16,7 @@ import org.saturnclient.feature.FeatureDetails;
* {@link #shouldZoom()} and {@link #getZoomLevel()} each frame. * {@link #shouldZoom()} and {@link #getZoomLevel()} each frame.
* No ModuleProvider is needed — there is no per-tick engine query. * No ModuleProvider is needed — there is no per-tick engine query.
*/ */
public class ZoomFeature extends Feature { public class ZoomFeature extends Mod {
private static final BoolProperty enabled = Property.bool(false); private static final BoolProperty enabled = Property.bool(false);
private static final BoolProperty toggle = Property.bool(false); private static final BoolProperty toggle = Property.bool(false);
@@ -28,7 +28,7 @@ public class ZoomFeature extends Feature {
public ZoomFeature() { public ZoomFeature() {
super( super(
new FeatureDetails("Zoom", "zoom") new ModSpec("Zoom", "zoom")
.description("Zoom in for a closer view") .description("Zoom in for a closer view")
.tags("Camera", "Utility") .tags("Camera", "Utility")
.version("v0.2.0"), .version("v0.2.0"),
@@ -1,21 +1,21 @@
package org.saturnclient.ui.components; package org.saturnclient.ui.components;
import org.saturnclient.feature.FeatureLayout; import org.saturnclient.mod.HudMod;
import org.saturnclient.feature.HudFeature; import org.saturnclient.mod.ModLayout;
import org.saturnclient.ui.Element; import org.saturnclient.ui.Element;
import org.saturnclient.ui.ElementContext; import org.saturnclient.ui.ElementContext;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
public class HudModPreview extends Element { public class HudModPreview extends Element {
HudFeature feature; HudMod feature;
public HudModPreview(HudFeature feature) { public HudModPreview(HudMod feature) {
this.feature = feature; this.feature = feature;
} }
@Override @Override
public void render(RenderScope scope, ElementContext ctx) { public void render(RenderScope scope, ElementContext ctx) {
FeatureLayout layout = feature.getDimensions(); ModLayout layout = feature.getDimensions();
if (layout.renderBackground) { if (layout.renderBackground) {
scope.drawRoundedRectangle(0, 0, layout.width, layout.height, scope.drawRoundedRectangle(0, 0, layout.width, layout.height,
@@ -2,8 +2,8 @@ package org.saturnclient.ui.components;
import org.saturnclient.common.provider.Providers; import org.saturnclient.common.provider.Providers;
import org.saturnclient.config.Theme; import org.saturnclient.config.Theme;
import org.saturnclient.feature.Feature; import org.saturnclient.mod.HudMod;
import org.saturnclient.feature.HudFeature; import org.saturnclient.mod.Mod;
import org.saturnclient.ui.Element; import org.saturnclient.ui.Element;
import org.saturnclient.ui.ElementContext; import org.saturnclient.ui.ElementContext;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
@@ -14,13 +14,13 @@ import org.saturnclient.ui.screens.ConfigEditor;
public class SaturnModule extends Element { public class SaturnModule extends Element {
private final Feature mod; private final Mod mod;
static int p = 10; // padding static int p = 10; // padding
static int s = 14; // settings icon size static int s = 14; // settings icon size
static int expand = 5; // settings icon click area static int expand = 5; // settings icon click area
public SaturnModule(Feature mod) { public SaturnModule(Mod mod) {
this.mod = mod; this.mod = mod;
this.width = 160; this.width = 160;
this.height = 50; this.height = 50;
@@ -142,7 +142,7 @@ public class SaturnModule extends Element {
1.0f); 1.0f);
if (settingsHover) { if (settingsHover) {
if (mod instanceof HudFeature h) { if (mod instanceof HudMod h) {
Providers.saturn.getClient().setScreen(new ConfigEditor(mod.getConfig(), h)); Providers.saturn.getClient().setScreen(new ConfigEditor(mod.getConfig(), h));
} else { } else {
Providers.saturn.getClient().setScreen(new ConfigEditor(mod.getConfig())); Providers.saturn.getClient().setScreen(new ConfigEditor(mod.getConfig()));
@@ -12,8 +12,8 @@ import org.saturnclient.config.property.KeybindingProperty;
import org.saturnclient.config.property.NamespaceProperty; import org.saturnclient.config.property.NamespaceProperty;
import org.saturnclient.config.property.Property; import org.saturnclient.config.property.Property;
import org.saturnclient.config.property.SelectProperty; import org.saturnclient.config.property.SelectProperty;
import org.saturnclient.feature.FeatureLayout; import org.saturnclient.mod.HudMod;
import org.saturnclient.feature.HudFeature; import org.saturnclient.mod.ModLayout;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.SaturnScreen; import org.saturnclient.ui.SaturnScreen;
import org.saturnclient.ui.components.HudModPreview; import org.saturnclient.ui.components.HudModPreview;
@@ -30,7 +30,7 @@ import org.saturnclient.ui.resources.Fonts;
public class ConfigEditor extends SaturnScreen { public class ConfigEditor extends SaturnScreen {
private ConfigManager config; private ConfigManager config;
private HudFeature hudFeature; private HudMod hudFeature;
private HudModPreview preview; private HudModPreview preview;
public ConfigEditor(ConfigManager config) { public ConfigEditor(ConfigManager config) {
@@ -39,7 +39,7 @@ public class ConfigEditor extends SaturnScreen {
this.config = config; this.config = config;
} }
public ConfigEditor(ConfigManager config, HudFeature hudFeature) { public ConfigEditor(ConfigManager config, HudMod hudFeature) {
super("Config Editor"); super("Config Editor");
this.config = config; this.config = config;
@@ -160,7 +160,7 @@ public class ConfigEditor extends SaturnScreen {
@Override @Override
public void render(RenderScope renderScope, int mouseX, int mouseY, float delta, long elapsed) { public void render(RenderScope renderScope, int mouseX, int mouseY, float delta, long elapsed) {
if (this.preview != null) { if (this.preview != null) {
FeatureLayout layout = hudFeature.getDimensions(); ModLayout layout = hudFeature.getDimensions();
draw(this.preview draw(this.preview
.dimensions(layout.width, (int) (layout.height * layout.scale.value * 2.0f)) .dimensions(layout.width, (int) (layout.height * layout.scale.value * 2.0f))
.scale(1.0f) // Because the centering won't work properly .scale(1.0f) // Because the centering won't work properly
@@ -2,10 +2,10 @@ package org.saturnclient.ui.screens;
import org.saturnclient.common.ref.render.MatrixStackRef; import org.saturnclient.common.ref.render.MatrixStackRef;
import org.saturnclient.config.ConfigManager; import org.saturnclient.config.ConfigManager;
import org.saturnclient.feature.HudFeature; import org.saturnclient.mod.HudMod;
import org.saturnclient.feature.FeatureLayout; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.FeatureManager; import org.saturnclient.mod.ModLayout;
import org.saturnclient.feature.Feature; import org.saturnclient.mod.ModManager;
import org.saturnclient.ui.RenderScope; import org.saturnclient.ui.RenderScope;
import org.saturnclient.ui.SaturnScreen; import org.saturnclient.ui.SaturnScreen;
@@ -13,17 +13,17 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class HudEditor extends SaturnScreen { public class HudEditor extends SaturnScreen {
private final List<HudFeature> hudMods = new ArrayList<>(); private final List<HudMod> hudMods = new ArrayList<>();
private HudFeature draggingMod = null; private HudMod draggingMod = null;
private boolean resizing = false; private boolean resizing = false;
private int offsetX, offsetY; private int offsetX, offsetY;
private static final int RESIZE_MARGIN = 3; private static final int RESIZE_MARGIN = 3;
public HudEditor() { public HudEditor() {
super("HUD Editor"); super("HUD Editor");
for (Feature m : FeatureManager.ENABLED_MODS) { for (Mod m : ModManager.ENABLED_MODS) {
if (m.isEnabled() && m instanceof HudFeature) { if (m.isEnabled() && m instanceof HudMod) {
hudMods.add((HudFeature) m); hudMods.add((HudMod) m);
} }
} }
} }
@@ -32,8 +32,8 @@ public class HudEditor extends SaturnScreen {
public boolean mouseClicked(double mouseX, double mouseY, int button) { public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (button == 0) { if (button == 0) {
for (int m = hudMods.size() - 1; m >= 0; m--) { for (int m = hudMods.size() - 1; m >= 0; m--) {
HudFeature mod = hudMods.get(m); HudMod mod = hudMods.get(m);
FeatureLayout dim = mod.getDimensions(); ModLayout dim = mod.getDimensions();
// Check if clicking the corner for resizing // Check if clicking the corner for resizing
if (isCorner(mouseX, mouseY, dim)) { if (isCorner(mouseX, mouseY, dim)) {
@@ -69,7 +69,7 @@ public class HudEditor extends SaturnScreen {
@Override @Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) { public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
if (draggingMod != null) { if (draggingMod != null) {
FeatureLayout dim = draggingMod.getDimensions(); ModLayout dim = draggingMod.getDimensions();
if (resizing) { if (resizing) {
// Scale based on cursor movement // Scale based on cursor movement
@@ -90,8 +90,8 @@ public class HudEditor extends SaturnScreen {
@Override @Override
public void render(RenderScope renderScope, int mouseX, int mouseY, float delta, long elapsed) { public void render(RenderScope renderScope, int mouseX, int mouseY, float delta, long elapsed) {
for (HudFeature mod : hudMods) { for (HudMod mod : hudMods) {
FeatureLayout dim = mod.getDimensions(); ModLayout dim = mod.getDimensions();
MatrixStackRef matrices = renderScope.getMatrixStack(); MatrixStackRef matrices = renderScope.getMatrixStack();
matrices.push(); matrices.push();
@@ -113,12 +113,12 @@ public class HudEditor extends SaturnScreen {
} }
} }
private boolean isInside(double mouseX, double mouseY, FeatureLayout dim) { private boolean isInside(double mouseX, double mouseY, ModLayout dim) {
return mouseX >= dim.x.value && mouseX <= dim.x.value + (dim.width * dim.scale.value) && return mouseX >= dim.x.value && mouseX <= dim.x.value + (dim.width * dim.scale.value) &&
mouseY >= dim.y.value && mouseY <= dim.y.value + (dim.height * dim.scale.value); mouseY >= dim.y.value && mouseY <= dim.y.value + (dim.height * dim.scale.value);
} }
private boolean isCorner(double mouseX, double mouseY, FeatureLayout dim) { private boolean isCorner(double mouseX, double mouseY, ModLayout dim) {
float rightX = dim.x.value + dim.width * dim.scale.value; float rightX = dim.x.value + dim.width * dim.scale.value;
float bottomY = dim.y.value + dim.height * dim.scale.value; float bottomY = dim.y.value + dim.height * dim.scale.value;
@@ -1,8 +1,8 @@
package org.saturnclient.ui.screens; package org.saturnclient.ui.screens;
import org.saturnclient.config.AnimationConfig; import org.saturnclient.config.AnimationConfig;
import org.saturnclient.feature.FeatureManager; import org.saturnclient.mod.Mod;
import org.saturnclient.feature.Feature; import org.saturnclient.mod.ModManager;
import org.saturnclient.ui.SaturnScreen; import org.saturnclient.ui.SaturnScreen;
import org.saturnclient.ui.anim.SlideFade; import org.saturnclient.ui.anim.SlideFade;
import org.saturnclient.ui.components.SaturnModule; import org.saturnclient.ui.components.SaturnModule;
@@ -29,7 +29,7 @@ public class ModMenu extends SaturnScreen {
AnimationStagger moduleStagger = new AnimationStagger(AnimationConfig.modMenu); AnimationStagger moduleStagger = new AnimationStagger(AnimationConfig.modMenu);
for (Feature mod : FeatureManager.MODS) { for (Mod mod : ModManager.MODS) {
moduleStagger.draw( moduleStagger.draw(
new SaturnModule(mod) new SaturnModule(mod)
.position((160 + g) * col, (50 + g) * row) .position((160 + g) * col, (50 + g) * row)