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

Commit 4280286

Browse files
committed
implement #174
1 parent 1539b21 commit 4280286

File tree

10 files changed

+41
-31
lines changed

10 files changed

+41
-31
lines changed

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/freelook/Freelook.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class Freelook extends AbstractCommonModule {
5454
private final BooleanOption invert = new BooleanOption("invert", false);
5555
private final EnumOption<Perspective> perspective = new EnumOption<>("perspective", Perspective.class,
5656
Perspective.THIRD_PERSON_BACK);
57-
private final BooleanOption toggle = new BooleanOption("toggle", false);
57+
private final BooleanOption toggle = new BooleanOption("toggle", "freelook.toggle.tooltip", false);
5858
private final EnumOption<Perspective> perspectiveAlt = new EnumOption<>("perspective.alt", Perspective.class,
5959
Perspective.THIRD_PERSON_FRONT);
6060
private final BooleanOption toggleAlt = new BooleanOption("toggle.alt", false);

1.20/src/main/java/io/github/axolotlclient/modules/freelook/Freelook.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public class Freelook extends AbstractCommonModule {
5252
new String[]{"snap_perspective", "freelook"},
5353
"freelook", value -> FeatureDisabler.update());
5454
private final BooleanOption invert = new BooleanOption("invert", false);
55-
private final EnumOption<Perspective> perspective = new EnumOption<Perspective>("perspective", Perspective.class,
55+
private final EnumOption<Perspective> perspective = new EnumOption<>("perspective", Perspective.class,
5656
Perspective.THIRD_PERSON_BACK);
57-
private final BooleanOption toggle = new BooleanOption("toggle", false);
57+
private final BooleanOption toggle = new BooleanOption("toggle", "freelook.toggle.tooltip", false);
5858
private final EnumOption<Perspective> perspectiveAlt = new EnumOption<>("perspective.alt", Perspective.class,
5959
Perspective.THIRD_PERSON_FRONT);
6060
private final BooleanOption toggleAlt = new BooleanOption("toggle.alt", false);

1.21.7/src/main/java/io/github/axolotlclient/modules/freelook/Freelook.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public class Freelook extends AbstractModule {
5454
);
5555
private final BooleanOption invert = new BooleanOption("invert", false);
5656
private final EnumOption<CameraType> perspective =
57-
new EnumOption<CameraType>("perspective", CameraType.class, CameraType.THIRD_PERSON_BACK);
58-
private final BooleanOption toggle = new BooleanOption("toggle", false);
57+
new EnumOption<>("perspective", CameraType.class, CameraType.THIRD_PERSON_BACK);
58+
private final BooleanOption toggle = new BooleanOption("toggle", "freelook.toggle.tooltip", false);
5959
private final EnumOption<CameraType> perspectiveAlt = new EnumOption<>("perspective.alt", CameraType.class,
6060
CameraType.THIRD_PERSON_FRONT);
6161
private final BooleanOption toggleAlt = new BooleanOption("toggle.alt", false);

1.21/src/main/java/io/github/axolotlclient/modules/freelook/Freelook.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public class Freelook extends AbstractModule {
5252
new String[]{"snap_perspective", "freelook"},
5353
"freelook", value -> FeatureDisabler.update());
5454
private final BooleanOption invert = new BooleanOption("invert", false);
55-
private final EnumOption<Perspective> perspective = new EnumOption<Perspective>("perspective", Perspective.class,
55+
private final EnumOption<Perspective> perspective = new EnumOption<>("perspective", Perspective.class,
5656
Perspective.THIRD_PERSON_BACK);
57-
private final BooleanOption toggle = new BooleanOption("toggle", false);
57+
private final BooleanOption toggle = new BooleanOption("toggle", "freelook.toggle.tooltip", false);
5858
private final EnumOption<Perspective> perspectiveAlt = new EnumOption<>("perspective.alt", Perspective.class,
5959
Perspective.THIRD_PERSON_FRONT);
6060
private final BooleanOption toggleAlt = new BooleanOption("toggle.alt", false);

1.8.9/src/main/java/io/github/axolotlclient/modules/freelook/Freelook.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class Freelook extends AbstractModule {
5555
private final BooleanOption invert = new BooleanOption("invert", false);
5656
private final EnumOption<Perspective> perspective = new EnumOption<>("perspective", Perspective.class,
5757
Perspective.THIRD_PERSON_BACK);
58-
private final BooleanOption toggle = new BooleanOption("toggle", false);
58+
private final BooleanOption toggle = new BooleanOption("toggle", "freelook.toggle.tooltip", false);
5959
private final EnumOption<Perspective> perspectiveAlt = new EnumOption<>("perspective.alt", Perspective.class,
6060
Perspective.THIRD_PERSON_FRONT);
6161
private final BooleanOption toggleAlt = new BooleanOption("toggle.alt", false);

common/src/main/java/io/github/axolotlclient/modules/hypixel/StatsMod.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ private static AxoText buildDuelsGameModesLine(PlayerData.DuelsData data) {
192192
@Getter
193193
private static final StatsMod instance = new StatsMod();
194194

195-
private final OptionCategory playerstats = OptionCategory.create("playerstats");
196-
197195
private void register(Commands commands) {
198196
final var command = Commands.literal("playerstats");
199197

@@ -241,6 +239,6 @@ public void init() {
241239

242240
@Override
243241
public OptionCategory getCategory() {
244-
return playerstats;
242+
return null;
245243
}
246244
}

common/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/StatsOverlay.java

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,23 @@
4242
import io.github.axolotlclient.bridge.util.AxoIdentifier;
4343
import io.github.axolotlclient.bridge.util.AxoText;
4444
import io.github.axolotlclient.modules.hud.gui.component.DynamicallyPositionable;
45-
import io.github.axolotlclient.modules.hud.gui.entry.BoxHudEntry;
45+
import io.github.axolotlclient.modules.hud.gui.entry.TextHudEntry;
4646
import io.github.axolotlclient.modules.hud.gui.layout.AnchorPoint;
4747
import io.github.axolotlclient.modules.hud.util.DefaultOptions;
4848
import io.github.axolotlclient.modules.hypixel.HypixelAbstractionLayer;
4949
import io.github.axolotlclient.modules.hypixel.PlayerData;
5050
import io.github.axolotlclient.modules.hypixel.PlayerData.Bedwars.CombinedGameData;
5151
import org.jetbrains.annotations.Nullable;
5252

53-
public class StatsOverlay extends BoxHudEntry implements DynamicallyPositionable {
53+
public class StatsOverlay extends TextHudEntry implements DynamicallyPositionable {
5454
@FunctionalInterface
5555
private interface EntryRenderer {
5656

5757
AxoText render(BedwarsTeam team, String name, PlayerData.Bedwars data, int winstreak);
5858
}
5959

60-
private record Entry(boolean acceptNull, String name, Predicate<StatsOverlay> condition, EntryRenderer compRenderer) {
60+
private record Entry(boolean acceptNull, String name, Predicate<StatsOverlay> condition,
61+
EntryRenderer compRenderer) {
6162

6263
}
6364

@@ -83,11 +84,10 @@ private RenderHelper(Map<String, PlayerData.Bedwars> stats, Map<BedwarsTeam, Lis
8384
}
8485

8586
private void renderColumn(AxoRenderContext ctx, Entry renderEntry) {
86-
final var shadow = true;
8787
final var dy = AxoMinecraftClient.getInstance().br$getFont().br$getFontHeight() + rowMargin.get();
8888

8989
int currY = getPos().y + padding.get();
90-
int newXCursor = ctx.br$drawString(AxoI18n.translate(renderEntry.name), xCursor, currY, 0xffffffff, shadow);
90+
int newXCursor = ctx.br$drawString(AxoI18n.translate(renderEntry.name), xCursor, currY, 0xffffffff, shadow.get());
9191

9292
currY += dy;
9393

@@ -101,7 +101,7 @@ private void renderColumn(AxoRenderContext ctx, Entry renderEntry) {
101101
(renderEntry.acceptNull ? renderEntry.compRenderer.render(team, playerName, null, 0) : AxoText.literal("?").br$color(AxoText.Color.RED)) :
102102
renderEntry.compRenderer.render(team, playerName, data, data.all().winstreak());
103103

104-
newXCursor = Math.max(newXCursor, ctx.br$drawString(text, xCursor, currY, 0xffffffff, shadow));
104+
newXCursor = Math.max(newXCursor, ctx.br$drawString(text, xCursor, currY, 0xffffffff, shadow.get()));
105105
currY += dy;
106106
}
107107
}
@@ -140,8 +140,8 @@ private void render(AxoRenderContext ctx) {
140140
}
141141

142142
private static final Map<String, PlayerData.Bedwars> SAMPLE_STATS = Map.of(
143-
"FloweyTF", createFake(525, 3, new CombinedGameData(4234, 5634, 500, 300, 1469, 336, 230, 123)),
144-
"Adaklys", createFake(179, 3, new CombinedGameData(1984, 2048, 300, 500, 834, 737, 123, 273)),
143+
"FloweyTF", createFake(525, 3, new CombinedGameData(4234, 5634, 500, 300, 1469, 336, 230, 123)),
144+
"Adaklys", createFake(179, 3, new CombinedGameData(1984, 2048, 300, 500, 834, 737, 123, 273)),
145145
"steve", createFake(5, 3, new CombinedGameData(10, 1, 10, 1, 10, 1, 10, 1))
146146
);
147147

@@ -164,11 +164,13 @@ private static PlayerData.Bedwars createFake(int level, int winstreak, CombinedG
164164
private final BooleanOption columnKdr = new BooleanOption("bedwars.stats_overlay.column.kdr", true);
165165
private final BooleanOption columnWlr = new BooleanOption("bedwars.stats_overlay.column.wlr", true);
166166
private final BooleanOption columnWs = new BooleanOption("bedwars.stats_overlay.column.ws", true);
167+
private final BooleanOption toggleKey = new BooleanOption("toggle", "bedwars.stats_overlay.toggle", true);
168+
private final BooleanOption autoActivate = new BooleanOption("bedwars.stats_overlay.auto_activate", true);
167169
private final BedwarsMod mod;
168170

169171
private Map<String, PlayerData.Bedwars> stats = new HashMap<>();
170172
private final Map<BedwarsTeam, List<String>> playersByTeam = new EnumMap<>(BedwarsTeam.class);
171-
private final AxoKeybinding toggle = AxoKeybinding.create(AxoKeys.KEY_UNKNOWN, "bedwars.toggle_stats_overlay", "category.axolotlclient");
173+
private final AxoKeybinding toggle = AxoKeybinding.create(AxoKeys.KEY_UNKNOWN, "bedwars_stats_overlay", "category.axolotlclient");
172174
private boolean shouldRender = false;
173175
@Nullable
174176
private String errorMessage = null;
@@ -182,7 +184,7 @@ void onStart() {
182184
playersByTeam.clear();
183185
// can't call clear here, since we need a fresh map to avoid requests from writing
184186
stats = new HashMap<>();
185-
shouldRender = true;
187+
shouldRender = toggleKey.get() && autoActivate.get();
186188

187189
if (!API.getInstance().getApiOptions().enabled.get()) {
188190
errorMessage = "API Not Enabled!";
@@ -221,7 +223,7 @@ public void onEnd() {
221223
@Override
222224
public void render(AxoRenderContext ctx, float delta) {
223225
if (errorMessage != null) {
224-
ctx.br$drawString(AxoText.Color.RED + errorMessage, getPos().x, getPos().y, 0xffffffff, true);
226+
ctx.br$drawString(AxoText.Color.RED + errorMessage, getPos().x, getPos().y, 0xffffffff, shadow.get());
225227
}
226228

227229
if (mod.inGame() && shouldRender) {
@@ -242,8 +244,12 @@ public void renderPlaceholderComponent(AxoRenderContext ctx, float delta) {
242244
@Override
243245
public void tick() {
244246
if (mod.inGame()) {
245-
if (this.toggle.br$consumeClick()) {
246-
shouldRender = !shouldRender;
247+
if (toggleKey.get()) {
248+
if (this.toggle.br$consumeClick()) {
249+
shouldRender = !shouldRender;
250+
}
251+
} else {
252+
shouldRender = toggle.br$isPressed();
247253
}
248254
}
249255
}
@@ -266,6 +272,7 @@ public AnchorPoint getAnchor() {
266272
@Override
267273
public List<Option<?>> getConfigurationOptions() {
268274
final var opts = super.getConfigurationOptions();
275+
opts.remove(textColor);
269276
opts.add(anchor);
270277
opts.add(padding);
271278
opts.add(columnMargin);
@@ -275,6 +282,8 @@ public List<Option<?>> getConfigurationOptions() {
275282
opts.add(columnKdr);
276283
opts.add(columnWlr);
277284
opts.add(columnWs);
285+
opts.add(toggleKey);
286+
opts.add(autoActivate);
278287
return opts;
279288
}
280289
}

common/src/main/resources/assets/axolotlclient/lang/en_us.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@
404404
"title_short": "Client Options",
405405
"tnttime": "TntTime",
406406
"toggle": "Toggle",
407-
"toggle.tooltip": "Use the set key to toggle whether Freelook is enabled.",
407+
"freelook.toggle.tooltip": "Use the set key to toggle whether Freelook is enabled.",
408408
"toggleSneak": "Allow Sneaking toggle",
409409
"toggleSprint": "Allow Sprinting toggle",
410410
"togglesprint": "ToggleModifiers",
@@ -800,11 +800,13 @@
800800
"hud.padding": "Padding",
801801
"hud.column_margin": "Column Margin",
802802
"hud.row_margin": "Row Margin",
803-
"bedwars.toggle_stats_overlay": "Toggle Stats Overlay",
804803
"bedwars.stats.overlay.header.level": "Level",
805804
"bedwars.stats_overlay.column.level": "Show Level",
806805
"bedwars.stats_overlay.column.fkdr": "Show Final Kill/Death Ratios",
807806
"bedwars.stats_overlay.column.kdr": "Show Kill/Death Ratios",
808807
"bedwars.stats_overlay.column.wlr": "Show Win/Loose Ratios",
809-
"bedwars.stats_overlay.column.ws": "Show Winstreaks"
808+
"bedwars.stats_overlay.column.ws": "Show Winstreaks",
809+
"bedwars.stats_overlay.toggle": "Whether the key toggles the overlay.",
810+
"bedwars.stats_overlay.auto_activate": "Automatic Activation",
811+
"bedwars.stats_overlay.auto_activate.tooltip": "Automatically activate on game start. Requires the overlay to be in toggle mode."
810812
}

common/src/main/resources/assets/axolotlclient/lang/fr_fr.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
"title_short": "Options du Client",
406406
"tnttime": "Secondes TNT",
407407
"toggle": "Basculer",
408-
"toggle.tooltip": "Utilisez la touche pour basculer l'activation de Freelook.",
408+
"freelook.toggle.tooltip": "Utilisez la touche pour basculer l'activation de Freelook.",
409409
"toggleSneak": "Activer le basculage d'accroupissement",
410410
"toggleSprint": "Activer le basculage de Sprint",
411411
"togglesprint": "Modifieurs de Bascules",
@@ -800,11 +800,12 @@
800800
"hud.padding": "Marge intérieure",
801801
"hud.column_margin": "Marge de colonne",
802802
"hud.row_margin": "Marge de ligne",
803-
"bedwars.toggle_stats_overlay": "Basculer la superposition des statistiques",
803+
"bedwars.stats_overlay.toggle": "Basculer la superposition des statistiques",
804804
"bedwars.stats.overlay.header.level": "Niveau",
805805
"bedwars.stats_overlay.column.level": "Afficher le niveau",
806806
"bedwars.stats_overlay.column.fkdr": "Afficher le ratio Final Kills/Morts",
807807
"bedwars.stats_overlay.column.kdr": "Afficher le ratio Kills/Morts",
808808
"bedwars.stats_overlay.column.wlr": "Afficher le ratio Victoires/Défaites",
809-
"bedwars.stats_overlay.column.ws": "Afficher les séries de victoires"
809+
"bedwars.stats_overlay.column.ws": "Afficher les séries de victoires",
810+
"bedwars.stats_overlay.auto_activate": "Activation automatique"
810811
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fabric.loom.disableMinecraftVerification=true
77
axolotlclient.modules.all=true
88

99
# Mod Properties
10-
version=3.1.5-beta.3
10+
version=3.1.5-beta.4
1111

1212
maven_group=io.github.axolotlclient
1313

0 commit comments

Comments
 (0)