No chat to show

This project's files are all here to explore.

Files
build.gradle
ChatListener.java
DuelConfig.java
DuelInviteParser.java
duelpopup-fabric-1.21.11.zip
DuelPopup.java
DuelPopupClient.java
DuelPopupRenderer.java
DuelRequestScreen.java
DuelSettingsScreen.java
en_us.json
fabric.mod.json
gradle.properties
KeyBindings.java
settings.gradle
Code
15 916
DuelPopupClient.java
package com.example.duelpopup;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.hud.VanillaHudElements;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.Identifier;

/** Client-only entrypoint (fabric.mod.json -> "environment": "client"). */
public final class DuelPopupClient implements ClientModInitializer {
    public static final String MOD_ID = "duelpopup";

    @Override
    public void onInitializeClient() {
        DuelConfig.load();
        KeyBindings.register();
        ChatListener.register();

        // Overlay mode: draw the popup on the HUD (just before the chat layer).
        HudElementRegistry.attachElementBefore(
                VanillaHudElements.CHAT,
                Identifier.of(MOD_ID, "duel_popup"),
                (context, tickCounter) -> {
                    MinecraftClient mc = MinecraftClient.getInstance();
                    if (!DuelPopup.isActive()) return;
                    // The clickable screen draws the popup itself - don't draw it twice.
                    if (mc.currentScreen instanceof DuelRequestScreen) return;
                    DuelPopupRenderer.render(context, mc.textRenderer,
                            mc.getWindow().getScaledWidth(), -1, -1, true);
                });
    }
}