LagNotifier module

LagNotifier: Minecraft 26.3 cheat module, full source for every implementation (1 client: MelaHack (ThunderHack fork)).

1 implementationMISC

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.

MelaHack (ThunderHack fork)MISCsrc/main/java/thunder/hack/features/modules/misc/LagNotifier.javaJava · 92 lines · 4.5 KB

Notifies about server lags.

SettingsRubberbandServerResponseResponseTresholdTPS
LagNotifier.javaJava · Minecraft 26.2 · 92 lines · 4.5 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.misc;
2
3
import thunder.hack.utility.render.compat.RenderSystem;
4
import meteordevelopment.orbit.EventHandler;
5
import net.minecraft.client.gui.GuiGraphicsExtractor;
6
import net.minecraft.network.protocol.game.ClientboundPlayerPositionPacket;
7
import net.minecraft.network.protocol.game.ClientboundSetTimePacket;
8
import thunder.hack.core.Managers;
9
import thunder.hack.core.manager.client.ModuleManager;
10
import thunder.hack.events.impl.PacketEvent;
11
import thunder.hack.gui.font.FontRenderers;
12
import thunder.hack.features.modules.Module;
13
import thunder.hack.gui.notification.Notification;
14
import thunder.hack.setting.Setting;
15
import thunder.hack.utility.Timer;
16
import thunder.hack.utility.render.Render2DEngine;
17
import thunder.hack.utility.render.TextureStorage;
18
19
import java.awt.*;
20
import java.text.DecimalFormat;
21
22
import static thunder.hack.features.modules.client.ClientSettings.isRu;
23
24
public class LagNotifier extends Module {
25
    public LagNotifier() {
26
        super("LagNotifier", Category.MISC);
27
    }
28
29
    private final Setting<Boolean> rubberbandNotify = new Setting<>("Rubberband", true);
30
    private final Setting<Boolean> serverResponseNotify = new Setting<>("ServerResponse", true);
31
    private final Setting<Integer> responseTreshold = new Setting<>("ResponseTreshold", 5, 0, 15, v -> serverResponseNotify.getValue());
32
    private final Setting<Boolean> tpsNotify = new Setting<>("TPS", true);
33
34
    private Timer notifyTimer = new Timer();
35
    private Timer rubberbandTimer = new Timer();
36
    private Timer packetTimer = new Timer();
37
38
    private boolean isLagging = false;
39
40
    @Override
41
    public void onEnable() {
42
        notifyTimer = new Timer();
43
        rubberbandTimer = new Timer();
44
        packetTimer = new Timer();
45
        isLagging = false;
46
47
        super.onEnable();
48
    }
49
50
    @EventHandler
51
    public void onPacketReceive(PacketEvent.Receive e) {
52
        if (fullNullCheck()) return;
53
54
        if (e.getPacket() instanceof ClientboundPlayerPositionPacket) rubberbandTimer.reset();
55
        if (e.getPacket() instanceof ClientboundSetTimePacket) packetTimer.reset();
56
    }
57
58
    public void onRender2D(GuiGraphicsExtractor context) {
59
        Render2DEngine.setupRender();
60
        RenderSystem.defaultBlendFunc();
61
62
        if (!rubberbandTimer.passedMs(5000) && rubberbandNotify.getValue()) {
63
            DecimalFormat decimalFormat = new DecimalFormat("#.#");
64
            FontRenderers.modules.drawCenteredString(context.pose(), (isRu() ? "Обнаружен руббербенд! " : "Rubberband detected! ") + decimalFormat.format((5000f - (float) rubberbandTimer.getTimeMs()) / 1000f), (float) mc.getWindow().getGuiScaledWidth() / 2f, (float) mc.getWindow().getGuiScaledHeight() / 3f, new Color(0xFFDF00).getRGB());
65
        }
66
67
        if (packetTimer.passedMs(responseTreshold.getValue() * 1000L) && serverResponseNotify.getValue()) {
68
            DecimalFormat decimalFormat = new DecimalFormat("#.#");
69
            FontRenderers.modules.drawCenteredString(context.pose(), (isRu() ? "Сервер перестал отвечать! " : "The server stopped responding! ") + decimalFormat.format((float) packetTimer.getTimeMs() / 1000f), (float) mc.getWindow().getGuiScaledWidth() / 2f, (float) mc.getWindow().getGuiScaledHeight() / 3f, new Color(0xFFDF00).getRGB());
70
71
            RenderSystem.setShaderColor(1f, 0.87f, 0f, 1f);
72
            context.blit(net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED, TextureStorage.lagIcon, (int) ((float) mc.getWindow().getGuiScaledWidth() / 2f - 40), (int) ((float) mc.getWindow().getGuiScaledHeight() / 3f - 120), 0, 0, 80, 80, 80, 80);
73
            RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
74
        }
75
76
        if (Managers.SERVER.getTPS() < 10 && notifyTimer.passedMs(60000) && tpsNotify.getValue()) {
77
            String msg = isRu() ? "ТПС сервера ниже 10!" : "Server TPS is below 10!";
78
            if (ModuleManager.tpsSync.isDisabled()) msg += isRu() ? " Рекомендуется включить TPSSync" : "It is recommended to enable TPSSync";
79
            Managers.NOTIFICATION.publicity("LagNotifier", msg, 8, Notification.Type.ERROR);
80
81
            isLagging = true;
82
            notifyTimer.reset();
83
        }
84
85
        if (Managers.SERVER.getTPS() > 15 && isLagging) {
86
            Managers.NOTIFICATION.publicity("LagNotifier", isRu() ? "ТПС сервера стабилизировался!" : "Server TPS has stabilized!", 8, Notification.Type.SUCCESS);
87
            isLagging = false;
88
        }
89
        Render2DEngine.endRender();
90
    }
91
}
92