// --- FIXED 1.20.1 KUBEJS CLIENT SCREEN SLAMMER ---

NetworkEvents.fromServer('open_stalker_popup', event => {
    const { data } = event;
    const username = data.get('name'); // Fix text extraction method for 1.20.1

    // Build and slam the custom canvas onto the viewport
    let horrorUI = OpenScreen.custom(() => {
        // Draw total pitch black across the game viewport window
        Render.fillScreen(0xFF000000); 

        // Primary headers and dynamic text assignments
        Render.drawText("⚠️ ACCESS VIOLATION ⚠️", (Client.window.guiScaledWidth / 2) - 60, 40, 0xFFFF0000, true);

        Render.drawText("I watched you download this profile.", 30, 80, 0xFFFFFFFF, false);
        Render.drawText(`I watched you boot up user: ${username}`, 30, 100, 0xFFFFFFFF, false);
        Render.drawText("You think a locked door from SecurityCraft keeps me out?", 30, 120, 0xFFFFFFFF, false);
        Render.drawText("Every time you step into a cave, I count your footsteps.", 30, 140, 0xFFFFFFFF, false);
        Render.drawText("Close the game. Look outside your window.", 30, 170, 0xFFD3D3D3, false);

        Render.drawText("> Writing raw telemetry buffer to instance...", 30, 210, 0xFF00FF00, false);
        Render.drawText("> Log successfully exported to local /.minecraft/stalker_data/log.txt", 30, 220, 0xFF00FF00, false);
        
        Render.drawText("[ PRESS ESCAPE TO RETURN TO SAFETY ]", (Client.window.guiScaledWidth / 2) - 100, Client.window.guiScaledHeight - 40, 0xFF555555, true);
    });

    // Forcibly open the canvas UI
    Client.setScreen(horrorUI);
});
.setScreen(horrorUI);
});