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

Commit 1fa16df

Browse files
committed
add text transparency slider to ScoreboardHuds
1 parent 566c471 commit 1fa16df

File tree

7 files changed

+40
-32
lines changed

7 files changed

+40
-32
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.mojang.datafixers.util.Pair;
3333
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
3434
import io.github.axolotlclient.AxolotlClientConfig.api.util.Color;
35+
import io.github.axolotlclient.AxolotlClientConfig.api.util.Colors;
3536
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
3637
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
3738
import io.github.axolotlclient.AxolotlClientConfig.impl.options.EnumOption;
@@ -81,6 +82,7 @@ public class ScoreboardHud extends TextHudEntry implements DynamicallyPositionab
8182
private final IntegerOption topPadding = new IntegerOption("toppadding", 0, 0, 4);
8283
private final BooleanOption scores = new BooleanOption("scores", true);
8384
private final ColorOption scoreColor = new ColorOption("scorecolor", new Color(0xFFFF5555));
85+
private final IntegerOption textAlpha = new IntegerOption("text_alpha", 255, 0, 255);
8486
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
8587
AnchorPoint.MIDDLE_RIGHT);
8688

@@ -120,11 +122,6 @@ public void renderPlaceholderComponent(MatrixStack matrices, float delta) {
120122
renderScoreboardSidebar(matrices, placeholder);
121123
}
122124

123-
@Override
124-
public boolean movable() {
125-
return true;
126-
}
127-
128125
// Abusing this could break some stuff/could allow for unfair advantages. The goal is not to do this, so it won't
129126
// show any more information than it would have in vanilla.
130127
private void renderScoreboardSidebar(MatrixStack matrices, ScoreboardObjective objective) {
@@ -206,9 +203,9 @@ private void renderScoreboardSidebar(MatrixStack matrices, ScoreboardObjective o
206203
}
207204

208205
if (shadow.get()) {
209-
client.textRenderer.drawWithShadow(matrices, scoreText, (float) scoreX, (float) relativeY, -1);
206+
client.textRenderer.drawWithShadow(matrices, scoreText, (float) scoreX, (float) relativeY, Colors.WHITE.withAlpha(textAlpha.get()).toInt());
210207
} else {
211-
client.textRenderer.draw(matrices, scoreText, (float) scoreX, (float) relativeY, -1);
208+
client.textRenderer.draw(matrices, scoreText, (float) scoreX, (float) relativeY, Colors.WHITE.withAlpha(textAlpha.get()).toInt());
212209
}
213210
if (this.scores.get()) {
214211
drawString(matrices, score, (float) (scoreX + maxWidth - client.textRenderer.getWidth(score) - 6),
@@ -223,9 +220,9 @@ private void renderScoreboardSidebar(MatrixStack matrices, ScoreboardObjective o
223220
float title = (float) (renderX + (maxWidth - displayNameWidth) / 2);
224221
if (shadow.get()) {
225222
client.textRenderer.drawWithShadow(matrices, text, title,
226-
(float) (relativeY - 9) - topPadding.get(), -1);
223+
(float) (relativeY - 9) - topPadding.get(), Colors.WHITE.withAlpha(textAlpha.get()).toInt());
227224
} else {
228-
client.textRenderer.draw(matrices, text, title, (float) (relativeY - 9), -1);
225+
client.textRenderer.draw(matrices, text, title, (float) (relativeY - 9), Colors.WHITE.withAlpha(textAlpha.get()).toInt());
229226
}
230227
}
231228
}
@@ -246,6 +243,7 @@ public List<Option<?>> getConfigurationOptions() {
246243
options.add(anchor);
247244
options.add(topPadding);
248245
options.remove(textColor);
246+
options.add(textAlpha);
249247
return options;
250248
}
251249

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.mojang.datafixers.util.Pair;
3333
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
3434
import io.github.axolotlclient.AxolotlClientConfig.api.util.Color;
35+
import io.github.axolotlclient.AxolotlClientConfig.api.util.Colors;
3536
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
3637
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
3738
import io.github.axolotlclient.AxolotlClientConfig.impl.options.EnumOption;
@@ -80,6 +81,7 @@ public class ScoreboardHud extends TextHudEntry implements DynamicallyPositionab
8081
private final IntegerOption topPadding = new IntegerOption("toppadding", 0, 0, 4);
8182
private final BooleanOption scores = new BooleanOption("scores", true);
8283
private final ColorOption scoreColor = new ColorOption("scorecolor", new Color(0xFFFF5555));
84+
private final IntegerOption textAlpha = new IntegerOption("text_alpha", 255, 0, 255);
8385
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
8486
AnchorPoint.MIDDLE_RIGHT);
8587

@@ -144,7 +146,7 @@ private void renderScoreboardSidebar(GuiGraphics graphics, ScoreboardObjective o
144146
MutableText formattedText;
145147
for (Iterator<ScoreboardPlayerScore> scoresIterator = scores.iterator(); scoresIterator
146148
.hasNext(); maxWidth = Math.max(maxWidth, client.textRenderer.getWidth(formattedText) + spacerWidth
147-
+ client.textRenderer.getWidth(Integer.toString(scoreboardPlayerScore.getScore())))) {
149+
+ client.textRenderer.getWidth(Integer.toString(scoreboardPlayerScore.getScore())))) {
148150
scoreboardPlayerScore = scoresIterator.next();
149151
Team team = scoreboard.getPlayerTeam(scoreboardPlayerScore.getPlayerName());
150152
formattedText = Team.decorateName(team, Text.literal(scoreboardPlayerScore.getPlayerName()));
@@ -199,7 +201,7 @@ private void renderScoreboardSidebar(GuiGraphics graphics, ScoreboardObjective o
199201
}
200202
}
201203

202-
graphics.drawText(client.textRenderer, scoreText, scoreX, relativeY, -1, shadow.get());
204+
graphics.drawText(client.textRenderer, scoreText, scoreX, relativeY, Colors.WHITE.withAlpha(textAlpha.get()).toInt(), shadow.get());
203205
if (this.scores.get()) {
204206
drawString(graphics, score, (float) (scoreX + maxWidth - client.textRenderer.getWidth(score) - 6),
205207
(float) relativeY, scoreColor.get().toInt(), shadow.get());
@@ -211,7 +213,7 @@ private void renderScoreboardSidebar(GuiGraphics graphics, ScoreboardObjective o
211213
10 + topPadding.get() * 2, topColor.get());
212214
}
213215
float title = (float) (renderX + (maxWidth - displayNameWidth) / 2);
214-
graphics.drawText(client.textRenderer, text, (int) title, (relativeY - 9) - topPadding.get(), -1, shadow.get());
216+
graphics.drawText(client.textRenderer, text, (int) title, (relativeY - 9) - topPadding.get(), Colors.WHITE.withAlpha(textAlpha.get()).toInt(), shadow.get());
215217
}
216218
}
217219

@@ -231,6 +233,7 @@ public List<Option<?>> getConfigurationOptions() {
231233
options.add(anchor);
232234
options.add(topPadding);
233235
options.remove(textColor);
236+
options.add(textAlpha);
234237
return options;
235238
}
236239

1.21.4/src/main/java/io/github/axolotlclient/modules/hud/gui/hud/vanilla/ScoreboardHud.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import net.minecraft.network.chat.numbers.NumberFormat;
4646
import net.minecraft.network.chat.numbers.StyledFormat;
4747
import net.minecraft.resources.ResourceLocation;
48+
import net.minecraft.util.ARGB;
4849
import net.minecraft.world.scores.*;
4950
import net.minecraft.world.scores.criteria.ObjectiveCriteria;
5051

@@ -82,6 +83,7 @@ public class ScoreboardHud extends TextHudEntry implements DynamicallyPositionab
8283
private final IntegerOption topPadding = new IntegerOption("toppadding", 0, 0, 4);
8384
private final BooleanOption scores = new BooleanOption("scores", true);
8485
private final ColorOption scoreColor = new ColorOption("scorecolor", new Color(0xFFFF5555));
86+
private final IntegerOption textAlpha = new IntegerOption("text_alpha", 255, 0, 255);
8587
private final EnumOption<AnchorPoint> anchor =
8688
new EnumOption<>("anchorpoint", AnchorPoint.class, AnchorPoint.MIDDLE_RIGHT);
8789

@@ -186,12 +188,12 @@ record DisplayEntry(Component name, Component score, int scoreWidth) {
186188
guiGraphics.fill(textX - 2, titleEnd - 9 - 1 - topPadding.get()*2, xEnd, titleEnd - 1, topColor.get().toInt());
187189
guiGraphics.fill(textX - 2, titleEnd - 1, xEnd, yEnd, backgroundColor.get().toInt());
188190
}
189-
guiGraphics.drawString(font, title, textX + maxWidth / 2 - titleWidth / 2, titleEnd - 9 - topPadding.get(), -1, shadow.get());
191+
guiGraphics.drawString(font, title, textX + maxWidth / 2 - titleWidth / 2, titleEnd - 9 - topPadding.get(), ARGB.color(textAlpha.get(), -1), shadow.get());
190192

191193
for (int v = 0; v < m; v++) {
192194
DisplayEntry lv2 = entries[v];
193195
int w = yEnd - (m - v) * 9;
194-
guiGraphics.drawString(font, lv2.name, textX, w, -1, shadow.get());
196+
guiGraphics.drawString(font, lv2.name, textX, w, ARGB.color(textAlpha.get(), -1), shadow.get());
195197
if (scores.get()) {
196198
guiGraphics.drawString(font, lv2.score, xEnd - lv2.scoreWidth, w, scoreColor.get().toInt(), shadow.get());
197199
}
@@ -212,6 +214,7 @@ public List<Option<?>> getConfigurationOptions() {
212214
options.add(anchor);
213215
options.add(topPadding);
214216
options.remove(textColor);
217+
options.add(textAlpha);
215218
return options;
216219
}
217220

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import io.github.axolotlclient.modules.hud.util.Rectangle;
4343
import io.github.axolotlclient.modules.hud.util.RenderUtil;
4444
import net.minecraft.client.gui.GuiGraphics;
45+
import net.minecraft.client.util.ColorUtil;
4546
import net.minecraft.scoreboard.*;
4647
import net.minecraft.text.MutableText;
4748
import net.minecraft.text.Text;
@@ -80,6 +81,7 @@ public class ScoreboardHud extends TextHudEntry implements DynamicallyPositionab
8081
private final IntegerOption topPadding = new IntegerOption("toppadding", 0, 0, 4);
8182
private final BooleanOption scores = new BooleanOption("scores", true);
8283
private final ColorOption scoreColor = new ColorOption("scorecolor", new Color(0xFFFF5555));
84+
private final IntegerOption textAlpha = new IntegerOption("text_alpha", 255, 0, 255);
8385
private final EnumOption<AnchorPoint> anchor = new EnumOption<>("anchorpoint", AnchorPoint.class,
8486
AnchorPoint.MIDDLE_RIGHT);
8587

@@ -199,7 +201,7 @@ private void renderScoreboardSidebar(GuiGraphics graphics, ScoreboardObjective o
199201
}
200202
}
201203

202-
graphics.drawText(client.textRenderer, scoreText, scoreX, relativeY, -1, shadow.get());
204+
graphics.drawText(client.textRenderer, scoreText, scoreX, relativeY, ColorUtil.Argb32.of(textAlpha.get(), -1), shadow.get());
203205
if (this.scores.get()) {
204206
drawString(graphics, score, (float) (scoreX + maxWidth - client.textRenderer.getWidth(score) - 6),
205207
(float) relativeY, scoreColor.get().toInt(), shadow.get());
@@ -211,7 +213,7 @@ private void renderScoreboardSidebar(GuiGraphics graphics, ScoreboardObjective o
211213
10 + topPadding.get() * 2, topColor.get());
212214
}
213215
float title = (float) (renderX + (maxWidth - displayNameWidth) / 2);
214-
graphics.drawText(client.textRenderer, text, (int) title, (relativeY - 9) - topPadding.get(), -1, shadow.get());
216+
graphics.drawText(client.textRenderer, text, (int) title, (relativeY - 9) - topPadding.get(), ColorUtil.Argb32.of(textAlpha.get(), -1), shadow.get());
215217
}
216218
}
217219

@@ -231,6 +233,7 @@ public List<Option<?>> getConfigurationOptions() {
231233
options.add(anchor);
232234
options.add(topPadding);
233235
options.remove(textColor);
236+
options.add(textAlpha);
234237
return options;
235238
}
236239

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.mojang.blaze3d.platform.GlStateManager;
3434
import io.github.axolotlclient.AxolotlClientConfig.api.options.Option;
3535
import io.github.axolotlclient.AxolotlClientConfig.api.util.Color;
36+
import io.github.axolotlclient.AxolotlClientConfig.api.util.Colors;
3637
import io.github.axolotlclient.AxolotlClientConfig.impl.options.BooleanOption;
3738
import io.github.axolotlclient.AxolotlClientConfig.impl.options.ColorOption;
3839
import io.github.axolotlclient.AxolotlClientConfig.impl.options.EnumOption;
@@ -84,6 +85,7 @@ public class ScoreboardHud extends TextHudEntry implements DynamicallyPositionab
8485
private final IntegerOption topPadding = new IntegerOption("toppadding", 0, 0, 4);
8586
private final BooleanOption scores = new BooleanOption("scores", true);
8687
private final ColorOption scoreColor = new ColorOption("scorecolor", new Color(0xFFFF5555));
88+
private final IntegerOption textAlpha = new IntegerOption("text_alpha", 255, 0, 255);
8789
private final EnumOption<AnchorPoint> anchor = DefaultOptions.getAnchorPoint(AnchorPoint.MIDDLE_RIGHT);
8890

8991
public ScoreboardHud() {
@@ -122,11 +124,6 @@ public void renderPlaceholderComponent(float delta) {
122124
renderScoreboardSidebar(placeholder, true);
123125
}
124126

125-
@Override
126-
public boolean movable() {
127-
return true;
128-
}
129-
130127
// Abusing this could break some stuff/could allow for unfair advantages. The goal is not to do this, so it won't
131128
// show any more information than it would have in vanilla.
132129
private void renderScoreboardSidebar(ScoreboardObjective objective, boolean placeholder) {
@@ -209,9 +206,9 @@ private void renderScoreboardSidebar(ScoreboardObjective objective, boolean plac
209206
}
210207

211208
if (shadow.get()) {
212-
client.textRenderer.drawWithShadow(scoreText, (float) scoreX, (float) relativeY, -1);
209+
client.textRenderer.drawWithShadow(scoreText, (float) scoreX, (float) relativeY, Colors.WHITE.withAlpha(textAlpha.get()).toInt());
213210
} else {
214-
client.textRenderer.draw(scoreText, scoreX, relativeY, -1);
211+
client.textRenderer.draw(scoreText, scoreX, relativeY, Colors.WHITE.withAlpha(textAlpha.get()).toInt());
215212
}
216213
if (this.scores.get()) {
217214
drawString(score, (float) (scoreX + maxWidth - client.textRenderer.getWidth(score) - 6),
@@ -225,9 +222,9 @@ private void renderScoreboardSidebar(ScoreboardObjective objective, boolean plac
225222
}
226223
float title = (renderX + (maxWidth - displayNameWidth) / 2F);
227224
if (shadow.get()) {
228-
client.textRenderer.drawWithShadow(text, title, (float) (relativeY - 9) - topPadding.get(), -1);
225+
client.textRenderer.drawWithShadow(text, title, (float) (relativeY - 9) - topPadding.get(), Colors.WHITE.withAlpha(textAlpha.get()).toInt());
229226
} else {
230-
client.textRenderer.draw(text, (int) title, (relativeY - 9), -1);
227+
client.textRenderer.draw(text, (int) title, (relativeY - 9), Colors.WHITE.withAlpha(textAlpha.get()).toInt());
231228
}
232229
}
233230
}
@@ -254,6 +251,7 @@ public List<Option<?>> getConfigurationOptions() {
254251
options.add(anchor);
255252
options.add(topPadding);
256253
options.remove(textColor);
254+
options.add(textAlpha);
257255
return options;
258256
}
259257

CHANGELOG.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### 3.1.0
44

5-
- Add a new Backend (made by Astralchroma)
5+
- Add a new Backend (made by `@Astralchroma`)
66
- Features:
77
- Friends
88
- Chats
@@ -11,14 +11,16 @@
1111
- rewrite DiscordRPC
1212
- 1.8.9 + 1.16_combat-6 now require java 17
1313
- rewritten config library
14-
- removed custom skies on 1.21.3 (there are better implementations available already)
15-
- removed HotbarHUD on 1.21.3 (big maintenance burden with buggy feature)
16-
- add Integration with WorldHost (1.21.1, 1.21.3)
14+
- removed custom skies on 1.21.4 (there are better implementations available already)
15+
- removed HotbarHUD on 1.21.4 (big maintenance burden with buggy feature)
16+
- add Integration with WorldHost (1.21.1, 1.21.4)
1717
- fix bugs (#131)
18-
- update to 1.21
18+
- update to 1.21.x
1919
- drop 1.19 version range
20-
- add filter capabilities to AutoBoop
20+
- add filter capabilities to AutoBoop (suggested by `@Mocha`)
2121
- refine notification system
22+
- text transparency option for ScoreboardHuds (suggested by `@haovi`)
23+
- migrate 1.21.4 to mojmap
2224

2325
### 3.0.6
2426

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,5 +581,6 @@
581581
"autoboop.filterlist.mode": "Filter Mode",
582582
"autoboop.filterlist.mode.disabled": "Disabled",
583583
"autoboop.filterlist.mode.whitelist": "Whitelist",
584-
"autoboop.filterlist.mode.blacklist": "Blacklist"
584+
"autoboop.filterlist.mode.blacklist": "Blacklist",
585+
"text_alpha": "Text Transparency"
585586
}

0 commit comments

Comments
 (0)