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

Commit 7b22b1d

Browse files
committed
add tablist background customization (#120)
1 parent 713f6de commit 7b22b1d

14 files changed

Lines changed: 125 additions & 8 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
2828
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
29+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2930
import com.mojang.authlib.GameProfile;
3031
import com.mojang.blaze3d.systems.RenderSystem;
3132
import io.github.axolotlclient.AxolotlClient;
@@ -284,4 +285,22 @@ private Text nickHider(PlayerListEntry entry, Operation<Text> original) {
284285
this.footer = BedwarsMod.getInstance().getGame().get().getBottomBarText();
285286
ci.cancel();
286287
}
288+
289+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/client/options/GameOptions;getTextBackgroundColor(I)I")))
290+
private void modifyBackground(MatrixStack stack, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
291+
var tablist = Tablist.getInstance();
292+
if (!tablist.backgroundEnabled.get()) {
293+
return;
294+
}
295+
if (tablist.customBackgroundColor.get()) {
296+
original.call(stack, x1, y1, x2, y2, tablist.backgroundColor.get().toInt());
297+
return;
298+
}
299+
original.call(stack, x1, y1, x2, y2, color);
300+
}
301+
302+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;renderLatencyIcon(Lnet/minecraft/client/util/math/MatrixStack;IIILnet/minecraft/client/network/PlayerListEntry;)V")))
303+
private void modifyBackground$2(MatrixStack stack, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
304+
modifyBackground(stack, x1, y1, x2, y2, color, original);
305+
}
287306
}

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/tablist/Tablist.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ public class Tablist extends AbstractModule {
5050
private final ColorOption pingColor4 = new ColorOption("pingColor4", Color.parse("#FFFF8800"));
5151
private final ColorOption pingColor5 = new ColorOption("pingColor5", Color.parse("#FFFF0000"));
5252
private final BooleanOption shadow = new BooleanOption("shadow", true);
53+
public final BooleanOption backgroundEnabled = new BooleanOption("enable_background", true);
54+
public final BooleanOption customBackgroundColor = new BooleanOption("custom_background_color", false);
55+
public final ColorOption backgroundColor = new ColorOption("bgcolor", new Color(Integer.MIN_VALUE));
5356
private final OptionCategory tablist = OptionCategory.create("tablist");
5457

5558
@Override
5659
public void init() {
5760
tablist.add(numericalPing, showPlayerHeads, shadow, showHeader, showFooter, alwaysShowHeadLayer);
5861
tablist.add(pingColor0, pingColor1, pingColor2, pingColor3, pingColor4, pingColor5);
62+
tablist.add(backgroundEnabled, customBackgroundColor, backgroundColor);
5963

6064
AxolotlClient.CONFIG.rendering.add(tablist);
6165
}

1.20/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
2929
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
30+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
3031
import com.llamalad7.mixinextras.sugar.Local;
3132
import com.mojang.authlib.GameProfile;
3233
import com.mojang.blaze3d.systems.RenderSystem;
@@ -277,4 +278,22 @@ private Text nickHider(PlayerListEntry entry, Operation<Text> original) {
277278
this.footer = BedwarsMod.getInstance().getGame().get().getBottomBarText();
278279
ci.cancel();
279280
}
281+
282+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V"), slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/GameOptions;getTextBackgroundColor(I)I")))
283+
private void modifyBackground(GuiGraphics instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
284+
var tablist = Tablist.getInstance();
285+
if (!tablist.backgroundEnabled.get()) {
286+
return;
287+
}
288+
if (tablist.customBackgroundColor.get()) {
289+
original.call(instance, x1, y1, x2, y2, tablist.backgroundColor.get().toInt());
290+
return;
291+
}
292+
original.call(instance, x1, y1, x2, y2, color);
293+
}
294+
295+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;renderLatencyIcon(Lnet/minecraft/client/gui/GuiGraphics;IIILnet/minecraft/client/network/PlayerListEntry;)V")))
296+
private void modifyBackground$2(GuiGraphics instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
297+
modifyBackground(instance, x1, y1, x2, y2, color, original);
298+
}
280299
}

1.20/src/main/java/io/github/axolotlclient/modules/tablist/Tablist.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ public class Tablist extends AbstractModule {
5050
private final ColorOption pingColor4 = new ColorOption("pingColor4", Color.parse("#FFFF8800"));
5151
private final ColorOption pingColor5 = new ColorOption("pingColor5", Color.parse("#FFFF0000"));
5252
private final BooleanOption shadow = new BooleanOption("shadow", true);
53+
public final BooleanOption backgroundEnabled = new BooleanOption("enable_background", true);
54+
public final BooleanOption customBackgroundColor = new BooleanOption("custom_background_color", false);
55+
public final ColorOption backgroundColor = new ColorOption("bgcolor", new Color(Integer.MIN_VALUE));
5356
private final OptionCategory tablist = OptionCategory.create("tablist");
5457

5558
@Override
5659
public void init() {
5760
tablist.add(numericalPing, showPlayerHeads, shadow, showHeader, showFooter, alwaysShowHeadLayer);
5861
tablist.add(pingColor0, pingColor1, pingColor2, pingColor3, pingColor4, pingColor5);
62+
tablist.add(backgroundEnabled, customBackgroundColor, backgroundColor);
5963

6064
AxolotlClient.CONFIG.rendering.add(tablist);
6165
}

1.21.5/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@
5454
import org.spongepowered.asm.mixin.Final;
5555
import org.spongepowered.asm.mixin.Mixin;
5656
import org.spongepowered.asm.mixin.Shadow;
57-
import org.spongepowered.asm.mixin.injection.At;
58-
import org.spongepowered.asm.mixin.injection.Inject;
59-
import org.spongepowered.asm.mixin.injection.ModifyArg;
60-
import org.spongepowered.asm.mixin.injection.ModifyVariable;
57+
import org.spongepowered.asm.mixin.injection.*;
6158
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
6259
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
6360

@@ -262,4 +259,22 @@ private Component nickHider(PlayerInfo playerInfo, Operation<Component> original
262259
this.footer = BedwarsMod.getInstance().getGame().get().getBottomBarText();
263260
ci.cancel();
264261
}
262+
263+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V"), slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/client/Options;getBackgroundColor(I)I")))
264+
private void modifyBackground(GuiGraphics instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
265+
var tablist = Tablist.getInstance();
266+
if (!tablist.backgroundEnabled.get()) {
267+
return;
268+
}
269+
if (tablist.customBackgroundColor.get()) {
270+
original.call(instance, x1, y1, x2, y2, tablist.backgroundColor.get().toInt());
271+
return;
272+
}
273+
original.call(instance, x1, y1, x2, y2, color);
274+
}
275+
276+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/PlayerTabOverlay;renderPingIcon(Lnet/minecraft/client/gui/GuiGraphics;IIILnet/minecraft/client/multiplayer/PlayerInfo;)V")))
277+
private void modifyBackground$2(GuiGraphics instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
278+
modifyBackground(instance, x1, y1, x2, y2, color, original);
279+
}
265280
}

1.21.5/src/main/java/io/github/axolotlclient/modules/tablist/Tablist.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ public class Tablist extends AbstractModule {
4949
private final ColorOption pingColor4 = new ColorOption("pingColor4", Color.parse("#FFFF8800"));
5050
private final ColorOption pingColor5 = new ColorOption("pingColor5", Color.parse("#FFFF0000"));
5151
private final BooleanOption shadow = new BooleanOption("shadow", true);
52+
public final BooleanOption backgroundEnabled = new BooleanOption("enable_background", true);
53+
public final BooleanOption customBackgroundColor = new BooleanOption("custom_background_color", false);
54+
public final ColorOption backgroundColor = new ColorOption("bgcolor", new Color(Integer.MIN_VALUE));
5255
private final OptionCategory tablist = OptionCategory.create("tablist");
5356

5457
@Override
5558
public void init() {
5659
tablist.add(numericalPing, showPlayerHeads, shadow, showHeader, showFooter, alwaysShowHeadLayer);
5760
tablist.add(pingColor0, pingColor1, pingColor2, pingColor3, pingColor4, pingColor5);
61+
tablist.add(backgroundEnabled, customBackgroundColor, backgroundColor);
5862

5963
AxolotlClient.CONFIG.rendering.add(tablist);
6064
}

1.21/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
2929
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
30+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
3031
import com.mojang.authlib.GameProfile;
3132
import com.mojang.blaze3d.systems.RenderSystem;
3233
import io.github.axolotlclient.AxolotlClient;
@@ -278,4 +279,22 @@ private Text nickHider(PlayerListEntry entry, Operation<Text> original) {
278279
this.footer = BedwarsMod.getInstance().getGame().get().getBottomBarText();
279280
ci.cancel();
280281
}
282+
283+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V"), slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/GameOptions;getTextBackgroundColor(I)I")))
284+
private void modifyBackground(GuiGraphics instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
285+
var tablist = Tablist.getInstance();
286+
if (!tablist.backgroundEnabled.get()) {
287+
return;
288+
}
289+
if (tablist.customBackgroundColor.get()) {
290+
original.call(instance, x1, y1, x2, y2, tablist.backgroundColor.get().toInt());
291+
return;
292+
}
293+
original.call(instance, x1, y1, x2, y2, color);
294+
}
295+
296+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiGraphics;fill(IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/PlayerListHud;renderLatencyIcon(Lnet/minecraft/client/gui/GuiGraphics;IIILnet/minecraft/client/network/PlayerListEntry;)V")))
297+
private void modifyBackground$2(GuiGraphics instance, int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
298+
modifyBackground(instance, x1, y1, x2, y2, color, original);
299+
}
281300
}

1.21/src/main/java/io/github/axolotlclient/modules/tablist/Tablist.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,16 @@ public class Tablist extends AbstractModule {
5050
private final ColorOption pingColor4 = new ColorOption("pingColor4", Color.parse("#FFFF8800"));
5151
private final ColorOption pingColor5 = new ColorOption("pingColor5", Color.parse("#FFFF0000"));
5252
private final BooleanOption shadow = new BooleanOption("shadow", true);
53+
public final BooleanOption backgroundEnabled = new BooleanOption("enable_background", true);
54+
public final BooleanOption customBackgroundColor = new BooleanOption("custom_background_color", false);
55+
public final ColorOption backgroundColor = new ColorOption("bgcolor", new Color(Integer.MIN_VALUE));
5356
private final OptionCategory tablist = OptionCategory.create("tablist");
5457

5558
@Override
5659
public void init() {
5760
tablist.add(numericalPing, showPlayerHeads, shadow, showHeader, showFooter, alwaysShowHeadLayer);
5861
tablist.add(pingColor0, pingColor1, pingColor2, pingColor3, pingColor4, pingColor5);
62+
tablist.add(backgroundEnabled, customBackgroundColor, backgroundColor);
5963

6064
AxolotlClient.CONFIG.rendering.add(tablist);
6165
}

1.8.9/src/main/java/io/github/axolotlclient/mixin/PlayerListHudMixin.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import java.util.List;
2626
import java.util.UUID;
2727

28+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
29+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2830
import com.llamalad7.mixinextras.sugar.Local;
2931
import io.github.axolotlclient.AxolotlClient;
3032
import io.github.axolotlclient.api.requests.UserRequest;
@@ -276,4 +278,22 @@ public abstract class PlayerListHudMixin extends GuiElement {
276278
this.footer = BedwarsMod.getInstance().getGame().get().getBottomBarText();
277279
ci.cancel();
278280
}
281+
282+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/overlay/PlayerTabOverlay;fill(IIIII)V"), slice = @Slice(to = @At(value = "CONSTANT", args = "intValue=553648127")))
283+
private void modifyBackground(int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
284+
var tablist = Tablist.getInstance();
285+
if (!tablist.backgroundEnabled.get()) {
286+
return;
287+
}
288+
if (tablist.customBackgroundColor.get()) {
289+
original.call(x1, y1, x2, y2, tablist.backgroundColor.get().toInt());
290+
return;
291+
}
292+
original.call(x1, y1, x2, y2, color);
293+
}
294+
295+
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/overlay/PlayerTabOverlay;fill(IIIII)V"), slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/overlay/PlayerTabOverlay;renderPing(IIILnet/minecraft/client/network/PlayerInfo;)V")))
296+
private void modifyBackground$2(int x1, int y1, int x2, int y2, int color, Operation<Void> original) {
297+
modifyBackground(x1, y1, x2, y2, color, original);
298+
}
279299
}

1.8.9/src/main/java/io/github/axolotlclient/modules/tablist/Tablist.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ public class Tablist extends AbstractModule {
4949
private final ColorOption pingColor4 = new ColorOption("pingColor4", Color.parse("#FFFF8800"));
5050
private final ColorOption pingColor5 = new ColorOption("pingColor5", Color.parse("#FFFF0000"));
5151
private final BooleanOption shadow = new BooleanOption("shadow", true);
52+
public final BooleanOption backgroundEnabled = new BooleanOption("enable_background", true);
53+
public final BooleanOption customBackgroundColor = new BooleanOption("custom_background_color", false);
54+
public final ColorOption backgroundColor = new ColorOption("bgcolor", new Color(Integer.MIN_VALUE));
5255
private final OptionCategory tablist = OptionCategory.create("tablist");
5356

5457
@Override
5558
public void init() {
5659
tablist.add(numericalPing, showPlayerHeads, shadow, alwaysShowHeadLayer);
5760
tablist.add(pingColor0, pingColor1, pingColor2, pingColor3, pingColor4, pingColor5);
61+
tablist.add(backgroundEnabled, customBackgroundColor, backgroundColor);
5862

5963
AxolotlClient.CONFIG.rendering.add(tablist);
6064
}

0 commit comments

Comments
 (0)