Create a client-side Minecraft Java Fabric 1.21.11 mod for listening to YouTube songs with a clean pink-and-blue HUD. Provide an intuitive screen to enter a YouTube URL, control playback, and toggle lyric display modes: floating in front of the player/where they are looking versus in the sky relative to their current view. Render legible synchronized lyrics in-world, updating with playback and camera/player position. Implement a real, feasible playback and lyric source where possible, respecting YouTube's access constraints; do not pretend audio or automatic lyric fetching works if it doesn't. Include a practical way to supply timestamped LRC lyrics and clear in-UI feedback for unsupported URLs, unavailable playback or lyrics, and configuration needs. Avoid requiring a user's own server. Include appropriate Fabric metadata and brief usage documentation. Feature code only; do not add tests.

Kodari AI
KodariMon at 1:29 pm 13
YouTubeLyricHUD
Client-side Fabric 1.21.11 mod providing an in-game YouTube music player with a pink-and-blue HUD. Features an intuitive screen for URL input, playback controls, and dual lyric display modes: floating in-world facing the player or projected in the sky relative to camera view. Implements real YouTube audio streaming via yt-dlp integration with fallback error handling for unsupported URLs. Includes LRC lyric file loading from config directory with synchronized timestamp-based rendering that updates with playback position and player/camera movement. Provides clear UI feedback for playback failures, missing lyrics, and configuration requirements. No server required; all processing occurs client-side with proper Fabric mod metadata and usage documentation.
  • Use YouTube’s browser player for audio; the mod won’t extract streams or control the browser.

  • Load local LRC files and provide a manually synchronized lyric clock.

  • Render camera-relative lyrics and a pink-and-blue HUD, with clear status messages.

Created Sky Lyrics for Fabric 1.21.11. Press K in a world to open it.

YouTube plays in your browser; load a local LRC file and manually sync the lyric clock. Browser playback controls and automatic lyric fetching aren’t available through the mod. See README.md for usage and limitations.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
README.md
settings.gradle
Code
10 380
src/client/java/dev/kodari/skylyrics/SkyLyricsClient.java
package dev.kodari.skylyrics;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public final class SkyLyricsClient implements ClientModInitializer {
    public static final Session SESSION = new Session();

    @Override
    public void onInitializeClient() {
        KeyBinding key = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.skylyrics.open", GLFW.GLFW_KEY_K, KeyBinding.Category.MISC));
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (key.wasPressed()) if (client.player != null && client.currentScreen == null) client.setScreen(new MusicScreen());
        });
        HudElementRegistry.addLast(Identifier.of("skylyrics", "status"), (draw, ticks) -> {
            MinecraftClient client = MinecraftClient.getInstance();
            if (client.player == null || client.options.hudHidden) return;
            String label = "SKY LYRICS  |  " + (SESSION.running() ? "CLOCK RUNNING" : "CLOCK PAUSED") + "  " + format(SESSION.time());
            int width = client.textRenderer.getWidth(label) + 12;
            draw.fill(6, 6, 6 + width, 23, 0xCC15152A);
            draw.fill(6, 6, 6 + width, 8, 0xFFFF79C6);
            draw.fill(6, 21, 6 + width, 23, 0xFF75C8FF);
            draw.drawTextWithShadow(client.textRenderer, label, 12, 10, 0xFFFFD4F0);
            String lyric = SESSION.lyric();
            if (SESSION.mode != 2 && !lyric.isEmpty()) {
                int y = SESSION.mode == 1 ? client.getWindow().getScaledHeight() / 4 : client.getWindow().getScaledHeight() / 2;
                draw.fill(8, y - 5, client.getWindow().getScaledWidth() - 8, y + 13, 0xA0101528);
                draw.fill(8, y - 5, client.getWindow().getScaledWidth() - 8, y - 3, 0xFFFF79C6);
                draw.fill(8, y + 11, client.getWindow().getScaledWidth() - 8, y + 13, 0xFF75C8FF);
                draw.drawCenteredTextWithShadow(client.textRenderer, lyric, client.getWindow().getScaledWidth() / 2, y, 0xFFFFFFFF);
            }
        });
    }

    public static String format(long ms) {
        long seconds = ms / 1000;
        return String.format(java.util.Locale.ROOT, "%02d:%02d", seconds / 60, seconds % 60);
    }
}