TheRealDonutt

make me a mod where it looks like i am twitch streaming but it is a fake chat no ai and i can move and edit the size of the stream chat make it fake

Kodari AI
KodariNov 2 at 4:23 pm 3
FakeTwitchOverlay
A Minecraft Fabric mod that creates a fake Twitch streaming overlay in-game. The mod renders a simulated Twitch chat window with realistic fake viewer messages, usernames, and emotes that appear automatically. Players can freely move the chat overlay anywhere on their screen using drag controls and resize it to their preferred dimensions. The overlay includes customizable chat speed, message frequency, and viewer count display. The fake chat requires no AI or internet connection, generating believable viewer interactions locally. The mod features a configurable interface for adjusting overlay opacity, chat colors, and message content pools, allowing players to create the illusion of live streaming directly within their Minecraft gameplay.
  1. Add a client HUD that displays a fixed set of fictional chat messages—no AI or network connection.

  2. Add a keybind-driven editor for changing the displayed chat, position, and scale, with settings saved locally.

Added the client-only Fake Stream Chat mod. Press G or open its Configure screen in Mod Menu to show or hide the overlay, move it, resize it, and edit its five chat messages. Settings save locally; the chat is entirely fake, with no AI, network connection, or actual stream.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
9 351
src/client/java/com/example/fakestreamchat/client/FakeStreamChatClient.java
package com.example.fakestreamchat.client;

import com.mojang.blaze3d.platform.InputConstants;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.resources.Identifier;

public final class FakeStreamChatClient implements ClientModInitializer {
    private static final Identifier HUD_ID = Identifier.fromNamespaceAndPath("fake_stream_chat", "chat_overlay");
    private static final int PANEL_WIDTH = 210;
    private static final int HEADER_HEIGHT = 18;
    private static final int LINE_HEIGHT = 12;
    private static final int LINE_COUNT = 5;
    private static final int PANEL_HEIGHT = HEADER_HEIGHT + LINE_COUNT * LINE_HEIGHT + 8;

    private KeyMapping openConfigKey;

    @Override
    public void onInitializeClient() {
        StreamChatConfig.load();

        KeyMapping.Category category = KeyMapping.Category.register(
                Identifier.fromNamespaceAndPath("fake_stream_chat", "controls")
        );
        this.openConfigKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
                "key.fake_stream_chat.open_config",
                InputConstants.KEY_G,
                category
        ));

        HudElementRegistry.addLast(HUD_ID, FakeStreamChatClient::renderOverlay);
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            if (this.openConfigKey.consumeClick()) {
                client.gui.setScreen(StreamChatConfig.createScreen(null));
            }
        });
    }

    private static void renderOverlay(GuiGraphicsExtractor graphics, net.minecraft.client.DeltaTracker deltaTracker) {
        if (!StreamChatConfig.enabled || Minecraft.getInstance().player == null) {
            return;
        }

        float scale = StreamChatConfig.scale / 100.0F;
        int scaledWidth = Math.round(PANEL_WIDTH * scale);
        int scaledHeight = Math.round(PANEL_HEIGHT * scale);
        int x = Math.max(0, Math.round((graphics.guiWidth() - scaledWidth) * StreamChatConfig.xPosition / 100.0F));
        int y = Math.max(0, Math.round((graphics.guiHeight() - scaledHeight) * StreamChatConfig.yPosition / 100.0F));

        graphics.pose().pushMatrix();
        graphics.pose().translate(x, y);
        graphics.pose().scale(scale, scale);

        graphics.fill(0, 0, PANEL_WIDTH, PANEL_HEIGHT, 0xD90B1018);
        graphics.fill(0, 0, PANEL_WIDTH, HEADER_HEIGHT, 0xF018202C);
        graphics.fill(0, HEADER_HEIGHT, PANEL_WIDTH, HEADER_HEIGHT + 1, 0xFF334052);
        graphics.fill(0, 0, 3, PANEL_HEIGHT, 0xFF9147FF);

        Minecraft minecraft = Minecraft.getInstance();
        Font font = minecraft.font;
        graphics.fill(8, 6, 14, 12, 0xFFFF4545);
        graphics.text(font, "STREAM CHAT", 18, 5, 0xFFFFFFFF, true);
        String viewers = "32 watching";
        graphics.text(font, viewers, PANEL_WIDTH - 7 - font.width(viewers), 5, 0xFF9AA5B4, true);

        for (int i = 0; i < LINE_COUNT; i++) {
            String line = fitLine(font, StreamChatConfig.chatLine(i), PANEL_WIDTH - 18);
            if (!line.isBlank()) {
                graphics.text(font, line, 9, HEADER_HEIGHT + 5 + i * LINE_HEIGHT, 0xFFE5E9F0, true);
            }
        }

        graphics.pose().popMatrix();
    }

    private static String fitLine(Font font, String line, int maxWidth) {
        String fitted = line;
        while (!fitted.isEmpty() && font.width(fitted) > maxWidth) {
            fitted = fitted.substring(0, fitted.offsetByCodePoints(fitted.length(), -1));
        }
        return fitted;
    }
}