Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 1618433

Browse files
committed
fix profile loading issues
1 parent 6a1e94b commit 1618433

File tree

10 files changed

+72
-7
lines changed

10 files changed

+72
-7
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/KeystrokeHud.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ public void reloadConfig() {
231231
keystrokes = null;
232232
}
233233

234+
@Override
235+
public void saveConfig() {
236+
saveKeystrokes();
237+
}
238+
234239
public interface KeystrokeRenderer {
235240

236241
void render(Keystroke stroke, MatrixStack graphics);

1.20/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/KeystrokeHud.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
3838
import io.github.axolotlclient.AxolotlClientConfig.impl.options.IntegerOption;
3939
import io.github.axolotlclient.bridge.render.AxoRenderContext;
40+
import io.github.axolotlclient.config.profiles.ProfileAware;
4041
import io.github.axolotlclient.mixin.KeyBindAccessor;
4142
import io.github.axolotlclient.modules.hud.ClickInputTracker;
4243
import io.github.axolotlclient.modules.hud.gui.keystrokes.KeystrokePositioningScreen;
@@ -73,7 +74,7 @@
7374
* @license GPL-3.0
7475
*/
7576

76-
public class KeystrokeHud extends TextHudEntry {
77+
public class KeystrokeHud extends TextHudEntry implements ProfileAware {
7778

7879
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClientCommon.resolveConfigFile("keystrokes.json");
7980
public static final Identifier ID = new Identifier("kronhud", "keystrokehud");
@@ -231,6 +232,16 @@ public Identifier getId() {
231232
return ID;
232233
}
233234

235+
@Override
236+
public void reloadConfig() {
237+
keystrokes = null;
238+
}
239+
240+
@Override
241+
public void saveConfig() {
242+
saveKeystrokes();
243+
}
244+
234245
public interface KeystrokeRenderer {
235246

236247
void render(Keystroke stroke, GuiGraphics graphics);

1.21.7/src/main/java/io/github/axolotlclient/mixin/InGameHudMixin.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,13 @@
4444
import net.minecraft.world.entity.Entity;
4545
import net.minecraft.world.entity.player.Player;
4646
import net.minecraft.world.scores.Objective;
47-
import org.spongepowered.asm.mixin.Debug;
4847
import org.spongepowered.asm.mixin.Final;
4948
import org.spongepowered.asm.mixin.Mixin;
5049
import org.spongepowered.asm.mixin.Shadow;
5150
import org.spongepowered.asm.mixin.injection.At;
5251
import org.spongepowered.asm.mixin.injection.Inject;
5352
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
5453

55-
@Debug(export = true)
5654
@Mixin(Gui.class)
5755
public abstract class InGameHudMixin {
5856

1.21.7/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/KeystrokeHud.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
3838
import io.github.axolotlclient.AxolotlClientConfig.impl.options.IntegerOption;
3939
import io.github.axolotlclient.bridge.render.AxoRenderContext;
40+
import io.github.axolotlclient.config.profiles.ProfileAware;
4041
import io.github.axolotlclient.modules.hud.ClickInputTracker;
4142
import io.github.axolotlclient.modules.hud.gui.keystrokes.KeystrokePositioningScreen;
4243
import io.github.axolotlclient.modules.hud.gui.keystrokes.KeystrokesScreen;
@@ -70,7 +71,7 @@
7071
* @license GPL-3.0
7172
*/
7273

73-
public class KeystrokeHud extends TextHudEntry {
74+
public class KeystrokeHud extends TextHudEntry implements ProfileAware {
7475

7576
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClientCommon.resolveConfigFile("keystrokes.json");
7677
public static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath("kronhud", "keystrokehud");
@@ -226,6 +227,16 @@ public ResourceLocation getId() {
226227
return ID;
227228
}
228229

230+
@Override
231+
public void reloadConfig() {
232+
keystrokes = null;
233+
}
234+
235+
@Override
236+
public void saveConfig() {
237+
saveKeystrokes();
238+
}
239+
229240
public interface KeystrokeRenderer {
230241

231242
void render(Keystroke stroke, GuiGraphics graphics);

1.21/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/KeystrokeHud.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
3838
import io.github.axolotlclient.AxolotlClientConfig.impl.options.IntegerOption;
3939
import io.github.axolotlclient.bridge.render.AxoRenderContext;
40+
import io.github.axolotlclient.config.profiles.ProfileAware;
4041
import io.github.axolotlclient.mixin.KeyBindAccessor;
4142
import io.github.axolotlclient.modules.hud.ClickInputTracker;
4243
import io.github.axolotlclient.modules.hud.gui.keystrokes.KeystrokePositioningScreen;
@@ -71,7 +72,7 @@
7172
* @license GPL-3.0
7273
*/
7374

74-
public class KeystrokeHud extends TextHudEntry {
75+
public class KeystrokeHud extends TextHudEntry implements ProfileAware {
7576

7677
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClientCommon.resolveConfigFile("keystrokes.json");
7778
public static final Identifier ID = Identifier.of("kronhud", "keystrokehud");
@@ -228,6 +229,16 @@ public Identifier getId() {
228229
return ID;
229230
}
230231

232+
@Override
233+
public void reloadConfig() {
234+
keystrokes = null;
235+
}
236+
237+
@Override
238+
public void saveConfig() {
239+
saveKeystrokes();
240+
}
241+
231242
public interface KeystrokeRenderer {
232243

233244
void render(Keystroke stroke, GuiGraphics graphics);

1.8.9/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/KeystrokeHud.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
3838
import io.github.axolotlclient.AxolotlClientConfig.impl.options.IntegerOption;
3939
import io.github.axolotlclient.bridge.render.AxoRenderContext;
40+
import io.github.axolotlclient.config.profiles.ProfileAware;
4041
import io.github.axolotlclient.mixin.KeyBindAccessor;
4142
import io.github.axolotlclient.modules.hud.ClickInputTracker;
4243
import io.github.axolotlclient.modules.hud.gui.keystrokes.KeystrokePositioningScreen;
@@ -72,7 +73,7 @@
7273
* @license GPL-3.0
7374
*/
7475

75-
public class KeystrokeHud extends TextHudEntry {
76+
public class KeystrokeHud extends TextHudEntry implements ProfileAware {
7677

7778
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClientCommon.resolveConfigFile("keystrokes.json");
7879
public static final Identifier ID = new Identifier("kronhud", "keystrokehud");
@@ -225,6 +226,16 @@ public Identifier getId() {
225226
return ID;
226227
}
227228

229+
@Override
230+
public void reloadConfig() {
231+
keystrokes = null;
232+
}
233+
234+
@Override
235+
public void saveConfig() {
236+
saveKeystrokes();
237+
}
238+
228239
public interface KeystrokeRenderer {
229240

230241
void render(Keystroke stroke);

common/src/main/java/io/github/axolotlclient/AxolotlClientCommon.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static Path resolveProfileConfigFile(String file) {
6464
}
6565

6666
public static final boolean NVG_SUPPORTED = OSUtil.getOS() != OSUtil.OperatingSystem.OTHER &&
67-
!Objects.requireNonNullElse(System.getenv("TMPDIR"), "").contains("Android");
67+
!Objects.requireNonNullElse(System.getenv("TMPDIR"), "").contains("Android") && !FabricLoader.getInstance().isModLoaded("vulkanmod");
6868

6969
public static final String VERSION = FabricLoader.getInstance()
7070
.getModContainer("axolotlclient-common")
@@ -266,6 +266,11 @@ protected final void registerModule(Module module) {
266266

267267
public void saveConfig() {
268268
getConfigManager().save();
269+
for (Module m : modules) {
270+
if (m instanceof ProfileAware p) {
271+
p.saveConfig();
272+
}
273+
}
269274
}
270275

271276
public Path getMainConfigFile() {

common/src/main/java/io/github/axolotlclient/config/profiles/ProfileAware.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@
2424

2525
public interface ProfileAware {
2626

27+
void saveConfig();
28+
2729
void reloadConfig();
2830
}

common/src/main/java/io/github/axolotlclient/config/profiles/Profiles.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public Profile newProfile(String name) {
118118
}
119119

120120
public Profile duplicate(Profile profile) {
121+
AxolotlClientCommon.getInstance().saveConfig();
121122
var duplicate = newProfile(AxoI18n.translate("profiles.duplicated", profile.name()));
122123
try {
123124
Files.copy(profile.getPath(), duplicate.getPath());

common/src/main/java/io/github/axolotlclient/modules/hud/HudManagerCommon.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ public void reloadConfig() {
299299
}
300300
}
301301

302+
@Override
303+
public void saveConfig() {
304+
saveCustomEntries();
305+
for (var hud : getEntries()) {
306+
if (hud instanceof ProfileAware p) {
307+
p.saveConfig();
308+
}
309+
}
310+
}
311+
302312
protected abstract void openScreen();
303313

304314
protected abstract void addExtraHud();

0 commit comments

Comments
 (0)