added mod detials

This commit is contained in:
2025-05-17 01:56:26 +02:00
parent 324ffe0c8b
commit edbfd0306a
5 changed files with 35 additions and 20 deletions
@@ -8,20 +8,12 @@ import org.saturnclient.ui2.RenderScope;
import net.minecraft.util.Identifier;
public abstract class Module {
private final String name;
private final String namespace;
private final String description;
private final ModuleDetails details;
private final ConfigManager configManager;
public final String[] tags;
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);
this.details = details;
configManager = new ConfigManager(details.name);
for (NamedProperty<?> prop : props) {
configManager.property(prop.name, prop.prop);
}
@@ -35,11 +27,11 @@ public abstract class Module {
public abstract void setEnabled(boolean e);
public final String getName() {
return name;
return details.name;
}
public Identifier getIconTexture() {
return Textures.getModIcon(namespace);
return Textures.getModIcon(details.namespace);
}
public ConfigManager getConfig() {
@@ -47,14 +39,14 @@ public abstract class Module {
}
public String getDescription() {
return description;
return details.description;
}
public String[] getTags() {
return tags;
return details.tags;
}
public String getVersion() {
return "v0.0.1";
return details.version;
}
}
@@ -18,8 +18,8 @@ public class ArmorDisplay extends Module implements HudMod {
public ArmorDisplay() {
super(new ModuleDetails("Armor Display", "armor").description("Displays armor durability")
.version("0.1.0")
.tags("utility"),
.version("v0.1.0")
.tags("Utility"),
enabled.named("Enabled"),
dimensions.prop());
}
@@ -11,7 +11,12 @@ public class AutoSprint extends Module {
private static Property<Boolean> enabled = new Property<>(true);
public AutoSprint() {
super(new ModuleDetails("Auto Sprint", "sprint").description("Makes the player always sprint").tags("Movement"), enabled.named("Enabled"));
super(
new ModuleDetails("Auto Sprint", "sprint")
.description("Makes the player always sprint")
.tags("Movement")
.version("v0.1.0"),
enabled.named("Enabled"));
}
@Override
@@ -14,7 +14,13 @@ public class Crosshair extends Module {
public static Property<Boolean> range_indicator = new Property<>(false);
public Crosshair() {
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"));
super(
new ModuleDetails("Crosshair", "crosshair")
.description("Changes the crosshair if you're aiming at a entity")
.tags("Visuals", "Utility")
.version("v0.1.0"),
enabled.named("Enabled"),
range_indicator.named("Range Indicator"));
}
@Override
@@ -4,6 +4,7 @@ import org.saturnclient.modules.Module;
import org.saturnclient.saturnclient.SaturnClient;
import org.saturnclient.saturnclient.config.Property;
import org.saturnclient.saturnclient.config.ThemeManager;
import org.saturnclient.ui2.resources.Fonts;
import org.saturnclient.ui2.resources.Textures;
import org.saturnclient.ui2.Element;
import org.saturnclient.ui2.ElementContext;
@@ -19,6 +20,7 @@ public class SaturnModule extends Element {
private static Property<Integer> fgColor = theme.property("fg", new Property<>(0xFFA1A2B8));
private static Property<Integer> iconFg = theme.property("icon-fg", new Property<>(0xFFA1A2B8));
private static Property<Integer> iconBg = theme.property("icon-bg", new Property<>(0xFF2e3248));
private static Property<Integer> tagBg = theme.property("tag-bg", new Property<>(0xFF2e3248));
private static Property<Integer> iconRadius = theme.property("icon-radius", new Property<>(10));
private static Property<Integer> radius = theme.property("radius", new Property<>(10));
@@ -64,6 +66,16 @@ public class SaturnModule extends Element {
renderScope.drawText(0.6f, mod.getName(), p+h+4, p + 1, true, fgColor.value);
renderScope.drawText(0.35f, mod.getVersion(), width - p - (int) (Fonts.getWidth(mod.getVersion(), false) * 0.35f), p + 1, false, fgColor.value);
int xt = p + h + 4;
for (String tag : mod.getTags()) {
int xtb = (int) (Fonts.getWidth(tag, false) * 0.4f);
renderScope.drawRoundedRectangle(xt, p + (h/2), xtb + 6, 12, 5, tagBg.value);
renderScope.drawText(0.4f, tag, xt+2, p + (h/2) + 3, false, fgColor.value);
xt += xtb + 9;
}
if (settingsHover) {
theme.setState("hovering");
}