HUD module

HUD: Minecraft 26.3 cheat module, full source for every implementation (4 clients: OfflineClient, Nicotine, KiwiClient, …).

4 implementationsMISCGeneralCLIENTRENDER

Full module source: 4 implementations

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

OfflineClientMISCsrc/main/java/com/jellypudding/offlineclient/modules/misc/HudModule.javaJava · 85 lines · 3.8 KB

The overlay you see whilst playing. Drag the pieces about with .hud edit.

HudModule.javaJava · Minecraft 26.2 · 85 lines · 3.8 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.misc;
2
3
import com.jellypudding.offlineclient.OfflineClient;
4
import com.jellypudding.offlineclient.event.Subscribe;
5
import com.jellypudding.offlineclient.event.events.Render2DEvent;
6
import com.jellypudding.offlineclient.gui.HudEditorScreen;
7
import com.jellypudding.offlineclient.gui.WindowGuiScreen;
8
import com.jellypudding.offlineclient.hud.HudElement;
9
import com.jellypudding.offlineclient.hud.HudManager;
10
import com.jellypudding.offlineclient.hud.elements.ArmourElement;
11
import com.jellypudding.offlineclient.hud.elements.CombatElement;
12
import com.jellypudding.offlineclient.hud.elements.CompassElement;
13
import com.jellypudding.offlineclient.hud.elements.HoleElement;
14
import com.jellypudding.offlineclient.hud.elements.InfoBarElement;
15
import com.jellypudding.offlineclient.hud.elements.InventoryElement;
16
import com.jellypudding.offlineclient.hud.elements.ItemCounterElement;
17
import com.jellypudding.offlineclient.hud.elements.LagNotifierElement;
18
import com.jellypudding.offlineclient.hud.elements.ModuleListElement;
19
import com.jellypudding.offlineclient.hud.elements.PlayerListElement;
20
import com.jellypudding.offlineclient.hud.elements.PlayerModelElement;
21
import com.jellypudding.offlineclient.hud.elements.PotionTimersElement;
22
import com.jellypudding.offlineclient.hud.elements.ServerInfoElement;
23
import com.jellypudding.offlineclient.hud.elements.TextElement;
24
import com.jellypudding.offlineclient.hud.elements.WatermarkElement;
25
import com.jellypudding.offlineclient.module.Category;
26
import com.jellypudding.offlineclient.module.Module;
27
import com.jellypudding.offlineclient.setting.Setting;
28
29
// The overlay itself lives in the hud package. This module owns the elements and
30
// their settings save and show in the ClickGUI like any other module.
31
public final class HudModule extends Module {
32
33
    private final HudManager manager = new HudManager();
34
    private final WatermarkElement watermark = new WatermarkElement();
35
36
    // addSettings is final and files the settings away without handing out the module.
37
    @SuppressWarnings("this-escape")
38
    public HudModule() {
39
        super("HUD", "The overlay you see whilst playing. Drag the pieces about with .hud edit.",
40
            Category.MISC);
41
        add(watermark, new ModuleListElement(), new InfoBarElement(),
42
            new ArmourElement(), new PotionTimersElement(), new ItemCounterElement(),
43
            new TextElement(), new CombatElement(), new LagNotifierElement(),
44
            new CompassElement(), new PlayerListElement(), new ServerInfoElement(),
45
            new InventoryElement(), new PlayerModelElement(), new HoleElement());
46
        searchTags("overlay", "watermark", "module list", "info", "hud editor");
47
    }
48
49
    private void add(HudElement... elements) {
50
        for (HudElement element : elements) {
51
            manager.add(element);
52
            addSettings(element.getSettings().toArray(new Setting<?>[0]));
53
        }
54
    }
55
56
    @Override
57
    public boolean enabledByDefault() {
58
        return true;
59
    }
60
61
    public HudManager getManager() {
62
        return manager;
63
    }
64
65
    // A key on the HUD opens the editor. The switch in the GUI still turns it all off.
66
    @Override
67
    public void onKeybind() {
68
        OfflineClient.MC.schedule(() -> OfflineClient.MC.gui.setScreen(new HudEditorScreen(manager)));
69
    }
70
71
    // The windowed ClickGUI draws the client name in the same corner as the watermark.
72
    private boolean cornerTaken() {
73
        return OfflineClient.MC.gui.screen() instanceof WindowGuiScreen
74
            && watermark.xPercent() < 25 && watermark.yPercent() < 25;
75
    }
76
77
    @Subscribe
78
    private void onRender2D(Render2DEvent event) {
79
        if (OfflineClient.MC.gui.screen() instanceof HudEditorScreen || cornerTaken()) {
80
            return;
81
        }
82
        manager.render(event.getContext(), mc.font, false);
83
    }
84
}
85
NicotineGeneralsrc/client/java/nicotine/mod/mods/general/HUD.javaJava · 51 lines · 1.5 KB
SettingsSeparatorLowercaseBoldItalic
HUD.javaJava · Minecraft 26.3 · 51 lines · 1.5 KB · complete file, verbatimOriginal ↗
1
package nicotine.mod.mods.general;
2
3
import com.mojang.blaze3d.platform.InputConstants;
4
import nicotine.events.ClientLevelTickEvent;
5
import nicotine.mod.Mod;
6
import nicotine.mod.ModCategory;
7
import nicotine.mod.option.DropDownOption;
8
import nicotine.mod.option.ToggleOption;
9
import nicotine.screens.clickgui.HUDScreen;
10
import nicotine.util.EventBus;
11
import nicotine.util.Keybind;
12
13
import java.util.Arrays;
14
15
import static nicotine.util.Common.mc;
16
17
public class HUD extends Mod {
18
    public static final DropDownOption separator = new DropDownOption(
19
            "Separator",
20
            new String[]{"->", ">", "<", "=", ":", ""}
21
    );
22
    public static final ToggleOption lowercase = new ToggleOption("Lowercase");
23
    public static final ToggleOption bold = new ToggleOption("Bold");
24
    public static final ToggleOption italic = new ToggleOption("Italic");
25
26
    public static HUDScreen screen;
27
28
    public HUD() {
29
        super(ModCategory.General, "HUD");
30
        this.alwaysEnabled = true;
31
32
        this.keybind.keyCode = InputConstants.KEY_H;
33
        this.keybind.name = "Editor";
34
35
        this.addOptions(Arrays.asList(lowercase, bold, italic, separator));
36
37
        screen = new HUDScreen();
38
        screen.init();
39
    }
40
41
    @Override
42
    protected void init() {
43
        EventBus.register(ClientLevelTickEvent.class, event -> {
44
            if (Keybind.keyDown(keybind.keyCode) && mc.gui.screen() == null)
45
                mc.gui.setScreen(screen);
46
47
            return true;
48
        });
49
    }
50
}
51
KiwiClientCLIENTsrc/main/java/com/tangykiwi/kiwiclient/module/client/HUD.javaJava · 52 lines · 2.2 KB

Displays the HUD

SettingsFPSPingTPSIPBiomeSpeedCoordsNether CoordsArmorInventoryActiveModsLRUDWaypoints
HUD.javaJava · Minecraft 26.2 · 52 lines · 2.2 KB · complete file, verbatimOriginal ↗
1
package com.tangykiwi.kiwiclient.module.client;
2
3
import java.util.Map;
4
import java.util.UUID;
5
import java.util.concurrent.ConcurrentHashMap;
6
7
import com.google.common.eventbus.Subscribe;
8
import com.mojang.datafixers.util.Either;
9
import com.tangykiwi.kiwiclient.event.DrawOverlayEvent;
10
import com.tangykiwi.kiwiclient.gui.hudeditor.HUDEditorScreen;
11
import com.tangykiwi.kiwiclient.gui.hudeditor.components.HUDComponent;
12
import com.tangykiwi.kiwiclient.module.Category;
13
import com.tangykiwi.kiwiclient.module.Module;
14
import com.tangykiwi.kiwiclient.module.setting.ToggleSetting;
15
16
import net.minecraft.world.phys.Vec3;
17
18
import com.tangykiwi.kiwiclient.module.setting.ModeSetting;
19
20
public class HUD extends Module {
21
    public Map<Either<UUID, String>, Vec3> waypoints = new ConcurrentHashMap<>();
22
23
    public HUD() {
24
        super("HUD", "Displays the HUD", Category.CLIENT,
25
            new ToggleSetting("FPS", "Display your FPS", true),
26
            new ToggleSetting("Ping", "Display your ping", true),
27
            new ToggleSetting("TPS", "Display server TPS", true),
28
            new ToggleSetting("IP", "Display server IP", true),
29
            new ToggleSetting("Biome", "Display current biome", true),
30
            new ToggleSetting("Speed", "Display current speed", true),
31
            new ToggleSetting("Coords", "Display current coordinates", true),
32
            new ToggleSetting("Nether Coords", "Display Nether/Overworld coordinates", true),
33
            new ToggleSetting("Armor", "Display armor status", true),
34
            new ToggleSetting("Inventory", "Display your inventory", true),
35
            new ToggleSetting("ActiveMods", "Display active mods", true).withChildren(
36
                new ModeSetting("LR", "Left or Right orientation", 1, "Left", "Right"),
37
                new ModeSetting("UD", "Up or Down orientation", 1, "Up", "Down")
38
            )
39
            //, new ToggleSetting("Waypoints", "Display player waypoints", true)
40
            );
41
    }
42
43
    @Subscribe
44
    public void onDrawOverlay(DrawOverlayEvent e) {
45
        for (HUDComponent component : HUDEditorScreen.INSTANCE.components) {
46
            if(getSetting(component.getName()).asToggle().getValue()) {
47
                component.render(e.getContext());
48
            }
49
        }
50
    }
51
}
52
LiquidBounce (Kotlin)RENDERsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/ModuleHud.ktKotlin · 168 lines · 5.7 KB
SettingsSigmaAlphaBlendRangeSpaceSeperatedNames
ModuleHud.ktKotlin · Minecraft 26.2 · 168 lines · 5.7 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.render
20
21
import net.ccbluex.liquidbounce.config.ConfigSystem
22
import net.ccbluex.liquidbounce.config.types.group.ToggleableValueGroup
23
import net.ccbluex.liquidbounce.config.types.group.ValueGroup
24
import net.ccbluex.liquidbounce.event.EventManager
25
import net.ccbluex.liquidbounce.event.events.BrowserReadyEvent
26
import net.ccbluex.liquidbounce.event.events.DisconnectEvent
27
import net.ccbluex.liquidbounce.event.events.ScreenEvent
28
import net.ccbluex.liquidbounce.event.events.SpaceSeperatedNamesChangeEvent
29
import net.ccbluex.liquidbounce.event.handler
30
import net.ccbluex.liquidbounce.features.misc.SelfDestruct.isDestructed
31
import net.ccbluex.liquidbounce.features.module.ClientModule
32
import net.ccbluex.liquidbounce.features.module.ModuleCategories
33
import net.ccbluex.liquidbounce.features.module.modules.render.ModuleHud.themes
34
import net.ccbluex.liquidbounce.integration.backend.browser.BrowserSettings
35
import net.ccbluex.liquidbounce.integration.screen.CustomScreenType
36
import net.ccbluex.liquidbounce.integration.screen.impl.CustomSharedMinecraftScreen
37
import net.ccbluex.liquidbounce.integration.screen.impl.CustomStandaloneMinecraftScreen
38
import net.ccbluex.liquidbounce.integration.screen.impl.CustomOverlay
39
import net.ccbluex.liquidbounce.integration.theme.ThemeManager
40
import net.ccbluex.liquidbounce.integration.theme.component.components.minimap.MinimapHudComponent
41
import net.ccbluex.liquidbounce.utils.client.inGame
42
import net.minecraft.client.gui.screens.DisconnectedScreen
43
import net.minecraft.client.gui.screens.LevelLoadingScreen
44
import net.minecraft.client.gui.screens.Screen
45
46
/**
47
 * Module HUD
48
 *
49
 * The client in-game dashboard.
50
 */
51
52
object ModuleHud : ClientModule("HUD", ModuleCategories.RENDER, state = true, hide = true) {
53
54
    override val running
55
        get() = this.enabled && !isDestructed
56
    override val baseKey: String
57
        get() = "${ConfigSystem.KEY_PREFIX}.module.hud"
58
59
    private val isVisible: Boolean
60
        get() = inGame
61
62
    var hudEditorSelected = false
63
        set(value) {
64
            if (value != field) {
65
                field = value
66
                updateOverlayVisibility(mc.gui.screen())
67
            }
68
        }
69
70
    private fun shouldShowOverlay(screen: Screen?): Boolean =
71
        screen !is DisconnectedScreen &&
72
            screen !is LevelLoadingScreen &&
73
            !(hudEditorSelected && isClickGuiScreen(screen))
74
75
    private fun isClickGuiScreen(screen: Screen?): Boolean =
76
        screen is CustomSharedMinecraftScreen && screen.screenType == CustomScreenType.CLICK_GUI ||
77
            screen is CustomStandaloneMinecraftScreen && screen.screenType == CustomScreenType.CLICK_GUI
78
79
    private fun updateOverlayVisibility(screen: Screen?) {
80
        if (!enabled || !isVisible) {
81
            overlay.close()
82
            return
83
        }
84
85
        overlay.visible = shouldShowOverlay(screen)
86
    }
87
88
    private var overlay = CustomOverlay(
89
        screenType = CustomScreenType.HUD,
90
        browserSettings = BrowserSettings(60, ::reopen)
91
    )
92
93
    init {
94
        tree(Blur)
95
    }
96
97
    object Blur : ToggleableValueGroup(ModuleHud, "Blur", enabled = true) {
98
        /**
99
         * Gaussian sigma controlling blur strength. Higher values produce stronger blur.
100
         */
101
        val sigma by float("Sigma", 5.0F, 1.0F..15.0F)
102
103
        /**
104
         * The range in which the blending from not-blurred to blurred occurs.
105
         */
106
        val alphaBlendRange by floatRange("AlphaBlendRange", 0.0F..0.75F, 0.0F..1.0F)
107
    }
108
109
    @Suppress("unused")
110
    private val spaceSeperatedNames by boolean("SpaceSeperatedNames", true).onChange { state ->
111
        EventManager.callEvent(SpaceSeperatedNamesChangeEvent(state))
112
        state
113
    }
114
115
    val isBlurEffectActive
116
        get() = Blur.enabled && !(mc.gui.hud.isHidden && mc.gui.screen() == null)
117
118
    val themes = tree(ValueGroup("Themes"))
119
120
    val components = tree(ValueGroup("AdditionalComponents")).apply {
121
        tree(MinimapHudComponent)
122
    }
123
124
    /**
125
     * Updates [themes] content
126
     */
127
    fun updateThemes() {
128
        // filterIsInstance then forEach to prevent ConcurrentModificationException
129
        themes.inner.filterIsInstance<ValueGroup>().forEach {
130
            themes.drop(it)
131
        }
132
        for (theme in ThemeManager.themes) {
133
            themes.tree(theme.settings)
134
        }
135
        themes.walkInit()
136
        themes.walkKeyPath()
137
    }
138
139
    override fun onEnabled() {
140
        updateOverlayVisibility(mc.gui.screen())
141
    }
142
143
    override fun onDisabled() {
144
        overlay.close()
145
    }
146
147
    @Suppress("unused")
148
    private val browserReadyHandler = handler<BrowserReadyEvent> { event ->
149
        tree(overlay.browserSettings)
150
    }
151
152
    @Suppress("unused")
153
    private val screenHandler = handler<ScreenEvent> { event ->
154
        updateOverlayVisibility(event.screen)
155
    }
156
157
    @Suppress("unused")
158
    private val disconnectHandler = handler<DisconnectEvent> {
159
        overlay.close()
160
    }
161
162
    fun reopen() {
163
        overlay.close()
164
        updateOverlayVisibility(mc.gui.screen())
165
    }
166
167
}
168