made the mod actually good

This commit is contained in:
2025-05-09 01:54:17 +02:00
parent 7fd0565f7f
commit 35440180ea
5 changed files with 72 additions and 16 deletions
@@ -12,11 +12,13 @@ public abstract class Module {
private final String namespace;
private final String description;
private final ConfigManager configManager;
public final String[] tags;
public Module(String name, String namespace, String description, NamedProperty<?>... props) {
this.name = name;
this.namespace = namespace;
this.description = description;
public Module(ModuleDetails details, NamedProperty<?>... props) {
this.name = details.name;
this.namespace = details.namespace;
this.description = details.description;
this.tags = details.tags;
configManager = new ConfigManager(name);
@@ -25,14 +27,6 @@ public abstract class Module {
}
}
public Module(ConfigManager config, String name, String namespace, String description) {
this.name = name;
this.namespace = namespace;
this.description = description;
configManager = config;
}
public void render(RenderScope scope) {}
public void tick() {}
@@ -55,4 +49,12 @@ public abstract class Module {
public String getDescription() {
return description;
}
public String[] getTags() {
return tags;
}
public String getVersion() {
return "v0.0.1";
}
}
@@ -0,0 +1,39 @@
package org.saturnclient.modules;
public class ModuleDetails {
public String name;
public String namespace;
public String description;
public String version;
public String[] tags = {};
public ModuleDetails(String name, String namespace) {
this.name = name;
this.namespace = namespace;
}
public ModuleDetails name(String name) {
this.name = name;
return this;
}
public ModuleDetails namespace(String namespace) {
this.namespace = namespace;
return this;
}
public ModuleDetails description(String description) {
this.description = description;
return this;
}
public ModuleDetails version(String version) {
this.version = version;
return this;
}
public ModuleDetails tags(String... tags) {
this.tags = tags;
return this;
}
}
@@ -3,6 +3,7 @@ package org.saturnclient.modules.mods;
import java.util.Objects;
import org.saturnclient.modules.Module;
import org.saturnclient.modules.ModuleDetails;
import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.saturnclient.config.Property;
@@ -10,7 +11,7 @@ public class AutoSprint extends Module {
private static Property<Boolean> enabled = new Property<>(true);
public AutoSprint() {
super("Auto Sprint", "sprint", "Makes the player always sprint", enabled.named("Enabled"));
super(new ModuleDetails("Auto Sprint", "sprint").description("Makes the player always sprint").tags("Movement"), enabled.named("Enabled"));
}
@Override
@@ -1,6 +1,7 @@
package org.saturnclient.modules.mods;
import org.saturnclient.modules.Module;
import org.saturnclient.modules.ModuleDetails;
import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.saturnclient.config.Property;
import org.saturnclient.ui2.RenderScope;
@@ -13,7 +14,7 @@ public class Crosshair extends Module {
public static Property<Boolean> range_indicator = new Property<>(false);
public Crosshair() {
super("Crosshair", "crosshair", "Changes the crosshair if you're aiming at a entity", enabled.named("Enabled"), range_indicator.named("Range Indicator"));
super(new ModuleDetails("Crosshair", "crosshair").description("Changes the crosshair if you're aiming at a entity").tags("Visuals", "Utility"), enabled.named("Enabled"), range_indicator.named("Range Indicator"));
}
@Override
@@ -25,6 +25,7 @@ public class SaturnModule extends Element {
private static Property<Integer> padding = theme.property("padding", new Property<Integer>(10));
private static Property<Integer> iconMargin = theme.property("icon-margin", new Property<Integer>(10));
private static Property<Integer> iconPadding = theme.property("icon-padding", new Property<Integer>(4));
private static Property<Integer> tagGap = theme.property("tag-gap", new Property<Integer>(4));
private static ThemeManager settingsTheme = new ThemeManager("SaturnModule$Settings", "hovering");
private static Property<Integer> settingsBg = settingsTheme.property("bg-color", new Property<Integer>(-16777216));
@@ -42,7 +43,7 @@ public class SaturnModule extends Element {
public SaturnModule(Module mod) {
this.mod = mod;
this.width = 180;
this.height = 140;
this.height = 113;
}
@Override
@@ -65,18 +66,30 @@ public class SaturnModule extends Element {
renderScope.matrices.translate(padding.value, padding.value, 0);
// Top part
renderScope.drawRoundedRectangle(0, 0, 20, 20, 10, iconBgColor.value);
renderScope.drawTexture(mod.getIconTexture(), iconPadding.value, iconPadding.value, 0, 0, 20 - (iconPadding.value * 2), 20 - (iconPadding.value * 2), iconColor.value);
renderScope.drawText(mod.getName(), 20 + iconMargin.value, (22 - Fonts.getHeight()) / 2, false, fgColor.value);
renderScope.matrices.push();
renderScope.matrices.translate(20 + iconMargin.value, ((22 - Fonts.getHeight()) / 2) + Fonts.getHeight(), 0);
renderScope.matrices.scale(0.5f, 0.5f, 1);
renderScope.drawText(formatText(mod.getDescription(), (int) ((width - iconMargin.value) * 1.5f)), 0, 0, false, -20);
renderScope.matrices.pop();
renderScope.matrices.pop();
// Mid part
int i = padding.value;
for (String tag : mod.getTags()) {
renderScope.matrices.push();
renderScope.matrices.translate(i, height - 40 - Fonts.getHeight(), 0);
renderScope.matrices.scale(0.5f, 0.5f, 1);
renderScope.drawText(tag, 0, 0, false, -20);
renderScope.matrices.pop();
i += (Fonts.getWidth(tag, false) * 0.5f) + tagGap.value;
}
// Settings button
renderScope.matrices.push();
renderScope.matrices.translate(padding.value, height - 30 - padding.value, 0);