Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class MeteorTextHud {
public static final HudElementInfo<TextHud>.Preset MODULE_ENABLED_WITH_INFO;
public static final HudElementInfo<TextHud>.Preset WATERMARK;
public static final HudElementInfo<TextHud>.Preset BARITONE;
public static final HudElementInfo<TextHud>.Preset PROFILE;

static {
addPreset("Empty", null);
Expand All @@ -54,6 +55,7 @@ public class MeteorTextHud {
MODULE_ENABLED_WITH_INFO = addPreset("Module enabled with info", "Kill Aura: {meteor.is_module_active(\"kill-aura\") ? #2 \"ON\" : #3 \"OFF\"} #1{meteor.get_module_info(\"kill-aura\")}", 0);
WATERMARK = addPreset("Watermark", "{meteor.name} #1{meteor.version}");
BARITONE = addPreset("Baritone", "Baritone: #1{baritone.process_name}");
PROFILE = addPreset("Profile", "Profile: #1{meteor.profile}");
}

private static TextHud create() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public void load() {
if (macros.get()) Macros.get().load(folder);
if (modules.get()) Modules.get().load(folder);
if (waypoints.get()) Waypoints.get().load(folder);

Profiles.get().setActiveProfile(this);
}

public void save() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@ public class Profiles extends System<Profiles> implements Iterable<Profile> {
public static final File FOLDER = new File(MeteorClient.FOLDER, "profiles");

private List<Profile> profiles = new ArrayList<>();
private Profile activeProfile = null;

public Profiles() {
super("profiles");
}

public void setActiveProfile(Profile profile) {
this.activeProfile = profile;
}

public String getActiveProfileName() {
return activeProfile != null ? activeProfile.name.get() : "None";
}

public static Profiles get() {
return Systems.get(Profiles.class);
}
Expand Down Expand Up @@ -85,12 +94,14 @@ public boolean isEmpty() {
public NbtCompound toTag() {
NbtCompound tag = new NbtCompound();
tag.put("profiles", NbtUtils.listToTag(profiles));
if (activeProfile != null) tag.putString("activeProfile", activeProfile.name.get());
return tag;
}

@Override
public Profiles fromTag(NbtCompound tag) {
profiles = NbtUtils.listFromTag(tag.getListOrEmpty("profiles"), Profile::new);
tag.getString("activeProfile").ifPresent(name -> activeProfile = get(name));

for (File file : FOLDER.listFiles()) {
if (file.isDirectory() && get(file.getName()) == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import meteordevelopment.meteorclient.systems.config.Config;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.profiles.Profiles;
import meteordevelopment.meteorclient.utils.PreInit;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
Expand Down Expand Up @@ -94,6 +95,7 @@ public static void init() {
.set("get_module_info", MeteorStarscript::getModuleInfo)
.set("get_module_setting", MeteorStarscript::getModuleSetting)
.set("prefix", MeteorStarscript::getMeteorPrefix)
.set("profile", () -> Value.string(Profiles.get().getActiveProfileName()))
);

// Baritone
Expand Down