Memory module

Memory: Minecraft 26.3 cheat module, full source for every implementation (1 client: Nicotine).

1 implementationHUD

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.

NicotineHUDsrc/client/java/nicotine/mod/mods/hud/Memory.javaJava · 37 lines · 1015 B
Memory.javaJava · Minecraft 26.3 · 37 lines · 1015 B · complete file, verbatimOriginal ↗
1
package nicotine.mod.mods.hud;
2
3
import net.minecraft.ChatFormatting;
4
import nicotine.events.ClientLevelTickEvent;
5
import nicotine.mod.HUDMod;
6
import nicotine.mod.ModCategory;
7
import nicotine.mod.mods.general.HUD;
8
import nicotine.util.EventBus;
9
10
import java.util.List;
11
12
13
public class Memory extends HUDMod {
14
15
    public Memory() {
16
        super(ModCategory.HUD, "Memory");
17
        this.anchor = HUDMod.Anchor.TopLeft;
18
    }
19
20
    @Override
21
    protected void init() {
22
        EventBus.register(ClientLevelTickEvent.class, event -> {
23
            if (!this.enabled)
24
                return true;
25
26
            long totalMemory = Runtime.getRuntime().totalMemory();
27
            long freeMemory = Runtime.getRuntime().freeMemory();
28
            long usedMemory = (totalMemory - freeMemory) / 1024L / 1024L;
29
30
            String memoryText = String.format("memory %s%s %03dMB", ChatFormatting.WHITE, HUD.separator.value, usedMemory);
31
            this.texts = List.of(memoryText);
32
33
            return true;
34
        });
35
    }
36
}
37