better-tab module

better-tab: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

1 implementationRender

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

Meteor ClientRendersrc/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTab.javaJava · 132 lines · 4.6 KB

Various improvements to the tab list.

Settingstablist-sizecolumn-heighthighlight-selfself-colorhighlight-friendsaccurate-latencygamemode
BetterTab.javaJava · Minecraft 26.2 · 132 lines · 4.6 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.render;
7
8
import meteordevelopment.meteorclient.settings.*;
9
import meteordevelopment.meteorclient.systems.config.Config;
10
import meteordevelopment.meteorclient.systems.friends.Friend;
11
import meteordevelopment.meteorclient.systems.friends.Friends;
12
import meteordevelopment.meteorclient.systems.modules.Categories;
13
import meteordevelopment.meteorclient.systems.modules.Module;
14
import meteordevelopment.meteorclient.utils.render.color.Color;
15
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
16
import net.minecraft.ChatFormatting;
17
import net.minecraft.client.multiplayer.PlayerInfo;
18
import net.minecraft.network.chat.Component;
19
import net.minecraft.network.chat.MutableComponent;
20
import net.minecraft.network.chat.TextColor;
21
import net.minecraft.world.level.GameType;
22
23
public class BetterTab extends Module {
24
25
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
26
27
    public final Setting<Integer> tabSize = sgGeneral.add(new IntSetting.Builder()
28
        .name("tablist-size")
29
        .description("How many players in total to display in the tablist.")
30
        .defaultValue(100)
31
        .min(1)
32
        .sliderRange(1, 1000)
33
        .build()
34
    );
35
36
    public final Setting<Integer> tabHeight = sgGeneral.add(new IntSetting.Builder()
37
        .name("column-height")
38
        .description("How many players to display in each column.")
39
        .defaultValue(20)
40
        .min(1)
41
        .sliderRange(1, 1000)
42
        .build()
43
    );
44
45
    private final Setting<Boolean> self = sgGeneral.add(new BoolSetting.Builder()
46
        .name("highlight-self")
47
        .description("Highlights yourself in the tablist.")
48
        .defaultValue(true)
49
        .build()
50
    );
51
52
    private final Setting<SettingColor> selfColor = sgGeneral.add(new ColorSetting.Builder()
53
        .name("self-color")
54
        .description("The color to highlight your name with.")
55
        .defaultValue(new SettingColor(250, 130, 30))
56
        .visible(self::get)
57
        .build()
58
    );
59
60
    private final Setting<Boolean> friends = sgGeneral.add(new BoolSetting.Builder()
61
        .name("highlight-friends")
62
        .description("Highlights friends in the tablist.")
63
        .defaultValue(true)
64
        .build()
65
    );
66
67
    public final Setting<Boolean> accurateLatency = sgGeneral.add(new BoolSetting.Builder()
68
        .name("accurate-latency")
69
        .description("Shows latency as a number in the tablist.")
70
        .defaultValue(true)
71
        .build()
72
    );
73
74
    private final Setting<Boolean> gamemode = sgGeneral.add(new BoolSetting.Builder()
75
        .name("gamemode")
76
        .description("Display gamemode next to the nick.")
77
        .defaultValue(false)
78
        .build()
79
    );
80
81
82
    public BetterTab() {
83
        super(Categories.Render, "better-tab", "Various improvements to the tab list.");
84
    }
85
86
    public Component getPlayerName(PlayerInfo playerListEntry) {
87
        Component name;
88
        Color color = null;
89
90
        name = playerListEntry.getTabListDisplayName();
91
        if (name == null) name = Component.literal(playerListEntry.getProfile().name());
92
93
        if (playerListEntry.getProfile().id().toString().equals(mc.player.getGameProfile().id().toString()) && self.get()) {
94
            color = selfColor.get();
95
        } else if (friends.get() && Friends.get().isFriend(playerListEntry)) {
96
            Friend friend = Friends.get().get(playerListEntry);
97
            if (friend != null) color = Config.get().friendColor.get();
98
        }
99
100
        if (color != null) {
101
            String nameString = name.getString();
102
103
            for (ChatFormatting format : ChatFormatting.values()) {
104
                if (TextColor.fromLegacyFormat(format) != null)
105
                    nameString = nameString.replace(format.toString(), "");
106
            }
107
108
            name = Component.literal(nameString).setStyle(name.getStyle().withColor(TextColor.fromRgb(color.getPacked())));
109
        }
110
111
        if (gamemode.get()) {
112
            GameType gm = playerListEntry.getGameMode();
113
            String gmText = "?";
114
            if (gm != null) {
115
                gmText = switch (gm) {
116
                    case SPECTATOR -> "Sp";
117
                    case SURVIVAL -> "S";
118
                    case CREATIVE -> "C";
119
                    case ADVENTURE -> "A";
120
                };
121
            }
122
            MutableComponent text = Component.literal("");
123
            text.append(name);
124
            text.append(" [" + gmText + "]");
125
            name = text;
126
        }
127
128
        return name;
129
    }
130
131
}
132