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

Commit 63fea03

Browse files
committed
cleanup auth & keystroke configurations, fix a small bug, move config files
1 parent d6cf558 commit 63fea03

File tree

39 files changed

+128
-282
lines changed

39 files changed

+128
-282
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
package io.github.axolotlclient;
2424

25-
import java.nio.file.Path;
2625
import java.util.ArrayList;
2726
import java.util.HashMap;
2827
import java.util.List;
@@ -69,12 +68,12 @@ public class AxolotlClient implements ClientModInitializer {
6968

7069
public static final String MODID = "axolotlclient";
7170
public static final HashMap<Identifier, Resource> runtimeResources = new HashMap<>();
72-
public static final Identifier badgeIcon = new Identifier("axolotlclient", "textures/badge.png");
71+
public static final Identifier badgeIcon = new Identifier(MODID, "textures/badge.png");
7372
public static final OptionCategory config = OptionCategory.create("storedOptions");
7473
public static final BooleanOption someNiceBackground = new BooleanOption("defNoSecret", false);
7574
public static final List<Module> modules = new ArrayList<>();
75+
public static final Logger LOGGER = new LoggerImpl();
7676
public static String VERSION;
77-
public static Logger LOGGER;
7877
public static AxolotlClientConfig CONFIG;
7978
public static ConfigManager configManager;
8079

@@ -101,15 +100,9 @@ private static void addExternalModules() {
101100
modules.addAll(ModuleLoader.loadExternalModules());
102101
}
103102

104-
public static void tickClient() {
105-
modules.forEach(Module::tick);
106-
}
107-
108103
@Override
109104
public void onInitializeClient() {
110105

111-
LOGGER = new LoggerImpl();
112-
113106
VERSION = FabricLoader.getInstance().getModContainer(MODID).orElseThrow(IllegalStateException::new)
114107
.getMetadata().getVersion().getFriendlyString();
115108

@@ -118,7 +111,6 @@ public void onInitializeClient() {
118111

119112
getModules();
120113
addExternalModules();
121-
122114
CONFIG.init();
123115

124116
new AxolotlClientCommon(LOGGER, Notifications.getInstance(), () -> configManager);
@@ -130,7 +122,7 @@ public void onInitializeClient() {
130122
CONFIG.config.add(config);
131123

132124
io.github.axolotlclient.AxolotlClientConfig.api.AxolotlClientConfig.getInstance()
133-
.register(configManager = new VersionedJsonConfigManager(FabricLoader.getInstance().getConfigDir().resolve("AxolotlClient.json"),
125+
.register(configManager = new VersionedJsonConfigManager(AxolotlClientCommon.getInstance().getMainConfigFile(),
134126
CONFIG.config, 2, (oldVersion, newVersion, config, json) -> {
135127
if (oldVersion.getMajor() == 1) {
136128
var keystrokes = json.get("hud").getAsJsonObject().get("keystrokehud")
@@ -150,16 +142,12 @@ public void onInitializeClient() {
150142

151143
modules.forEach(Module::lateInit);
152144

153-
ClientTickEvents.END_CLIENT_TICK.register(client -> tickClient());
145+
ClientTickEvents.END_CLIENT_TICK.register(client -> modules.forEach(Module::tick));
154146

155147
FeatureDisabler.init();
156148

157149
LOGGER.debug("Debug Output activated, Logs will be more verbose!");
158150

159151
LOGGER.info("AxolotlClient Initialized");
160152
}
161-
162-
public static Path resolveConfigFile(String file) {
163-
return AxolotlClientCommon.resolveConfigFile(file);
164-
}
165153
}

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/auth/Auth.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,21 @@
2222

2323
package io.github.axolotlclient.modules.auth;
2424

25-
import java.nio.file.Path;
2625
import java.util.*;
2726

2827
import com.mojang.authlib.GameProfile;
2928
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
30-
import com.mojang.util.UUIDTypeAdapter;
3129
import io.github.axolotlclient.AxolotlClient;
3230
import io.github.axolotlclient.AxolotlClientConfig.api.options.OptionCategory;
3331
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
3432
import io.github.axolotlclient.api.API;
33+
import io.github.axolotlclient.api.util.UUIDHelper;
3534
import io.github.axolotlclient.mixin.MinecraftClientAccessor;
3635
import io.github.axolotlclient.modules.Module;
37-
import io.github.axolotlclient.util.Logger;
3836
import io.github.axolotlclient.util.ThreadExecuter;
3937
import io.github.axolotlclient.util.notifications.Notifications;
4038
import io.github.axolotlclient.util.options.GenericOption;
4139
import lombok.Getter;
42-
import net.fabricmc.loader.api.FabricLoader;
4340
import net.minecraft.client.MinecraftClient;
4441
import net.minecraft.client.gui.screen.ConfirmScreen;
4542
import net.minecraft.client.gui.screen.Screen;
@@ -80,11 +77,6 @@ public void init() {
8077
AxolotlClient.CONFIG.general.add(category);
8178
}
8279

83-
@Override
84-
protected Path getConfigDir() {
85-
return FabricLoader.getInstance().getConfigDir();
86-
}
87-
8880
@Override
8981
protected void login(Account account) {
9082
if (client.world != null) {
@@ -117,11 +109,6 @@ protected void login(Account account) {
117109
}
118110
}
119111

120-
@Override
121-
protected Logger getLogger() {
122-
return AxolotlClient.LOGGER;
123-
}
124-
125112
public void loadTextures(String uuid, String name) {
126113
if (!textures.containsKey(uuid) && !loadingTexture.contains(uuid)) {
127114
ThreadExecuter.scheduleTask(() -> {
@@ -131,7 +118,7 @@ public void loadTextures(String uuid, String name) {
131118
gameProfile = profileCache.get(uuid);
132119
} else {
133120
try {
134-
UUID uUID = UUIDTypeAdapter.fromString(uuid);
121+
UUID uUID = UUIDHelper.fromUndashed(uuid);
135122
gameProfile = new GameProfile(uUID, name);
136123
gameProfile = client.getSessionService().fillProfileProperties(gameProfile, false);
137124
} catch (IllegalArgumentException var2) {
@@ -176,7 +163,7 @@ public Identifier getSkinTexture(String uuid, String name) {
176163
return id;
177164
}
178165
try {
179-
UUID uUID = UUIDTypeAdapter.fromString(uuid);
166+
UUID uUID = UUID.fromString(uuid);
180167
return DefaultSkinHelper.getTexture(uUID);
181168
} catch (IllegalArgumentException ignored) {
182169
return DefaultSkinHelper.getTexture();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import com.google.gson.stream.JsonWriter;
3232
import io.github.axolotlclient.AxolotlClient;
33+
import io.github.axolotlclient.AxolotlClientCommon;
3334
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
3435
import io.github.axolotlclient.AxolotlClientConfig.api.options.OptionCategory;
3536
import io.github.axolotlclient.modules.AbstractModule;
@@ -64,7 +65,7 @@
6465

6566
public class HudManager extends AbstractModule {
6667

67-
private final static Path CUSTOM_MODULE_SAVE_PATH = AxolotlClient.resolveConfigFile("custom_hud.json");
68+
private final static Path CUSTOM_MODULE_SAVE_PATH = AxolotlClientCommon.resolveConfigFile("custom_hud.json");
6869
private final static HudManager INSTANCE = new HudManager();
6970
private final OptionCategory hudCategory = OptionCategory.create("hud");
7071
private final Map<Identifier, HudEntry> entries;

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.stream.Collectors;
3131

3232
import io.github.axolotlclient.AxolotlClient;
33+
import io.github.axolotlclient.AxolotlClientCommon;
3334
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
3435
import io.github.axolotlclient.AxolotlClientConfig.api.util.Color;
3536
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
@@ -71,7 +72,7 @@
7172

7273
public class KeystrokeHud extends TextHudEntry {
7374

74-
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClient.resolveConfigFile("keystrokes.json");
75+
private static final Path KEYSTROKE_SAVE_FILE = AxolotlClientCommon.resolveConfigFile("keystrokes.json");
7576
public static final Identifier ID = new Identifier("kronhud", "keystrokehud");
7677

7778
private final ColorOption pressedTextColor = new ColorOption("heldtextcolor", new Color(0xFF000000));

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public class KeyBindSelectionList extends ElementListWidget<KeyBindSelectionList
4646
private static final int ITEM_HEIGHT = 20;
4747
final KeyBindSelectionScreen keyBindsScreen;
4848
private final Consumer<KeyBinding> selectionConsumer;
49-
private int maxNameWidth;
5049

5150
public KeyBindSelectionList(KeyBindSelectionScreen keyBindsScreen, MinecraftClient minecraft, Consumer<KeyBinding> selectionConsumer) {
5251
super(minecraft, keyBindsScreen.width, keyBindsScreen.height, 33, keyBindsScreen.height - 33, ITEM_HEIGHT);
@@ -64,10 +63,6 @@ public KeyBindSelectionList(KeyBindSelectionScreen keyBindsScreen, MinecraftClie
6463
}
6564

6665
Text component = new TranslatableText(keyMapping.getTranslationKey());
67-
int i = minecraft.textRenderer.getWidth(component);
68-
if (i > this.maxNameWidth) {
69-
this.maxNameWidth = i;
70-
}
7166

7267
this.addEntry(new KeyEntry(keyMapping, component));
7368
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public List<? extends Element> children() {
9999
public class KeyEntry extends Entry {
100100
private static final Text REMOVE_BUTTON_TITLE = new TranslatableText("keystrokes.stroke.remove");
101101
private final KeystrokeHud.Keystroke key;
102-
private Text name;
102+
private final Text name;
103103
private final ButtonWidget configureButton, removeButton;
104104

105105
KeyEntry(final KeystrokeHud.Keystroke key, final Text name) {
@@ -109,6 +109,7 @@ public class KeyEntry extends Entry {
109109
this.removeButton = new ButtonWidget(0, 0, 50, 20, REMOVE_BUTTON_TITLE, b -> {
110110
removeEntry(this);
111111
keyBindsScreen.removeKey(key);
112+
setScrollAmount(getScrollAmount());
112113
});
113114
}
114115

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
public class SpecialKeystrokeSelectionList extends ElementListWidget<SpecialKeystrokeSelectionList.Entry> {
4444
private static final int ITEM_HEIGHT = 20;
4545
final AddSpecialKeystrokeScreen keyBindsScreen;
46-
private int maxNameWidth;
4746

4847
public SpecialKeystrokeSelectionList(AddSpecialKeystrokeScreen keyBindsScreen, MinecraftClient minecraft) {
4948
super(minecraft, keyBindsScreen.width, keyBindsScreen.height, 33, keyBindsScreen.height - 33, ITEM_HEIGHT);
@@ -52,13 +51,7 @@ public SpecialKeystrokeSelectionList(AddSpecialKeystrokeScreen keyBindsScreen, M
5251
Arrays.sort(strokes);
5352

5453
for (KeystrokeHud.SpecialKeystroke keyMapping : strokes) {
55-
Text component = new TranslatableText(keyMapping.getKey().getTranslationKey());
56-
int i = minecraft.textRenderer.getWidth(component);
57-
if (i > this.maxNameWidth) {
58-
this.maxNameWidth = i;
59-
}
60-
61-
this.addEntry(new KeyEntry(keyMapping, component));
54+
this.addEntry(new KeyEntry(keyMapping));
6255
}
6356
}
6457

@@ -79,15 +72,14 @@ public abstract static class Entry extends ElementListWidget.Entry<Entry> {
7972

8073
@Environment(EnvType.CLIENT)
8174
public class KeyEntry extends Entry {
82-
private final Text name, boundKey;
75+
private final Text boundKey;
8376
private final ButtonWidget addButton;
8477
private final KeystrokeHud.Keystroke keystroke;
8578

86-
KeyEntry(final KeystrokeHud.SpecialKeystroke key, final Text name) {
87-
this.name = name;
79+
KeyEntry(final KeystrokeHud.SpecialKeystroke key) {
8880
this.keystroke = keyBindsScreen.hud.newSpecialStroke(key);
8981
this.boundKey = key.getKey().getBoundKeyLocalizedText();
90-
this.addButton = new ButtonWidget(0, 0, 75, 20, new TranslatableText("keystrokes.stroke.add"), button -> keyBindsScreen.hud.keystrokes.add(keystroke));
82+
this.addButton = new ButtonWidget(0, 0, 75, 20, new TranslatableText("keystrokes.stroke.add"), button -> keyBindsScreen.hud.keystrokes.add(keyBindsScreen.hud.newSpecialStroke(key)));
9183
}
9284

9385
@Override

1.20/src/main/java/io/github/axolotlclient/AxolotlClient.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
package io.github.axolotlclient;
2424

25-
import java.nio.file.Path;
2625
import java.util.ArrayList;
2726
import java.util.HashMap;
2827
import java.util.List;
@@ -72,7 +71,7 @@ public class AxolotlClient implements ClientModInitializer {
7271

7372
public static final String MODID = "axolotlclient";
7473
public static final HashMap<Identifier, Resource> runtimeResources = new HashMap<>();
75-
public static final Identifier badgeIcon = new Identifier("axolotlclient", "textures/badge.png");
74+
public static final Identifier badgeIcon = new Identifier(MODID, "textures/badge.png");
7675
public static final OptionCategory config = OptionCategory.create("storedOptions");
7776
public static final BooleanOption someNiceBackground = new BooleanOption("defNoSecret", false);
7877
public static final List<Module> modules = new ArrayList<>();
@@ -105,10 +104,6 @@ private static void addExternalModules() {
105104
modules.addAll(ModuleLoader.loadExternalModules());
106105
}
107106

108-
public static void tickClient() {
109-
modules.forEach(Module::tick);
110-
}
111-
112107
@Override
113108
public void onInitializeClient() {
114109

@@ -119,7 +114,6 @@ public void onInitializeClient() {
119114

120115
getModules();
121116
addExternalModules();
122-
123117
CONFIG.init();
124118

125119
new AxolotlClientCommon(LOGGER, Notifications.getInstance(), () -> configManager);
@@ -131,7 +125,7 @@ public void onInitializeClient() {
131125
CONFIG.getConfig().add(config);
132126

133127
io.github.axolotlclient.AxolotlClientConfig.api.AxolotlClientConfig.getInstance()
134-
.register(configManager = new VersionedJsonConfigManager(FabricLoader.getInstance().getConfigDir().resolve("AxolotlClient.json"),
128+
.register(configManager = new VersionedJsonConfigManager(AxolotlClientCommon.getInstance().getMainConfigFile(),
135129
CONFIG.getConfig(), 2, (oldVersion, newVersion, config, json) -> {
136130
if (oldVersion.getMajor() == 1) {
137131
var keystrokes = json.get("hud").getAsJsonObject().get("keystrokehud")
@@ -151,7 +145,7 @@ public void onInitializeClient() {
151145

152146
modules.forEach(Module::lateInit);
153147

154-
ClientTickEvents.END_CLIENT_TICK.register(client -> tickClient());
148+
ClientTickEvents.END_CLIENT_TICK.register(client -> modules.forEach(Module::tick));
155149
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(SkyResourceManager.getInstance());
156150

157151
FeatureDisabler.init();
@@ -160,8 +154,4 @@ public void onInitializeClient() {
160154

161155
LOGGER.info("AxolotlClient Initialized");
162156
}
163-
164-
public static Path resolveConfigFile(String file) {
165-
return AxolotlClientCommon.resolveConfigFile(file);
166-
}
167157
}

0 commit comments

Comments
 (0)