COWBOY SHOOTER

make a health indicator mod with animation like hearts going down and regen animation cool and a ui opens with a keybind like this but make the ui a different style more things in the ui and make the health indicator show invis player health too like fully invis player too like if he dont have armor gaps anything in his hot or left hand still can see hearts and also working health indicator shows absorption hearts too and also add armor bar too and if player dont want the armor bar they can hide thru ui add more thing you like in the ui also make the mod working dont crass when i press the keybind and if player crit someone working hearts goes down normmaly shown and everything working the main thing make the ui unique not same

1 image attached
Kodari AI
KodariSep 25 at 2:12 pm 2
VitalityOverlay
Adds a customizable HUD overlay showing player health, absorption hearts, and armor bar with smooth damage/regen animations. Hidden players' vitals are visible through invisibility. A unique radial UI opens via keybind, offering toggles for armor bar, animation effects, and overlay style, plus extra widgets like status icons and combat log. Fully functional without crashes.
  1. Build a client-only Fabric mod with a distinct dashboard screen and configurable player-health HUD.

  2. Animate health loss, regeneration, absorption, and armor; include loaded invisible players and a keybind to open settings.

  3. Add the Fabric project metadata and assets.

Created Vitality HUD, a client-only Fabric 1.21.11 mod with an H-key dashboard, a nearby-player HUD, animated health loss and regeneration, absorption and optional armor meters, range and scale controls, and a compact layout. It tracks loaded invisible players independently of their appearance, with an optional “VEILED” marker.

The HUD can only show players the client has received from the server; it can’t reveal players the server doesn’t send to the client. I didn’t run a build.

COWBOY SHOOTER

no not like this not vital system the hearts show hearts on there head and they can adjust normal health indicator type i was not mean the animated to this the hearts looks animated like normal we see

1 image attached
Kodari AI
KodariSep 25 at 3:32 pm 5
  • Replace the screen-space player list with camera-facing heart indicators above loaded players, including invisible ones.

  • Show health changes with brief hit/regen flashes, plus optional absorption hearts and armor bar.

  • Keep the H-key dashboard, refocused on heart style, scale, range, and visibility options.

Changed the display to render heart icons above nearby players instead of a screen-space player list. Health updates immediately with brief damage and regeneration flashes; the H-key dashboard still lets you adjust heart style and size, range, absorption hearts, armor bar, and self-display. Invisible players are included when their entities are loaded by the client.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
7 508
src/client/java/dev/kodari/vitalityhud/VitalityHudClient.java
package dev.kodari.vitalityhud;

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.font.TextRenderer;
import net.minecraft.client.gui.Click;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

public class VitalityHudClient implements ClientModInitializer {
    private static final String MOD_ID = "vitalityhud";
    private static final int[] ACCENTS = {0xFF53D8C4, 0xFFBD78FF, 0xFFFFB84D};
    private static final KeyBinding.Category KEY_CATEGORY = KeyBinding.Category.create(Identifier.of(MOD_ID, "main"));
    private static final KeyBinding OPEN_DASHBOARD = KeyBindingHelper.registerKeyBinding(
            new KeyBinding("key.vitalityhud.open", 72, KEY_CATEGORY)
    );

    static boolean hudEnabled = true;
    static boolean armorEnabled = true;
    static boolean absorptionEnabled = true;
    static boolean showSelf;
    static boolean markInvisible = true;
    static int range = 48;
    static int scaleIndex = 1;
    static int accentIndex;
    static int indicatorStyle;

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (OPEN_DASHBOARD.wasPressed()) {
                if (client.player != null) {
                    client.setScreen(new DashboardScreen());
                }
            }
        });

        OverheadHeartRenderer.register();
        HudElementRegistry.addLast(Identifier.of(MOD_ID, "overhead_hearts"), (context, tickCounter) -> OverheadHeartRenderer.render(context));
    }

    static int accentColor() {
        return ACCENTS[accentIndex];
    }

    private static final class DashboardScreen extends Screen {
        private static final int PANEL_WIDTH = 350;
        private static final int PANEL_HEIGHT = 370;
        private static final int ROW_START = 65;
        private static final int ROW_HEIGHT = 27;
        private static final int ROW_COUNT = 9;

        private DashboardScreen() {
            super(Text.literal("Overhead Hearts"));
        }

        @Override
        public void render(DrawContext context, int mouseX, int mouseY, float deltaTicks) {
            context.fill(0, 0, width, height, 0xB9000000);
            int left = (width - PANEL_WIDTH) / 2;
            int top = (height - PANEL_HEIGHT) / 2;
            int accent = ACCENTS[accentIndex];

            context.fill(left, top, left + PANEL_WIDTH, top + PANEL_HEIGHT, 0xFF111925);
            context.drawStrokedRectangle(left, top, PANEL_WIDTH, PANEL_HEIGHT, 0xFF425064);
            context.fill(left + 1, top + 1, left + PANEL_WIDTH - 1, top + 4, accent);
            context.drawTextWithShadow(textRenderer, "HEARTS ABOVE", left + 18, top + 15, 0xFFF2F6FA);
            context.drawTextWithShadow(textRenderer, "OVERHEAD INDICATOR  /  DISPLAY SETTINGS", left + 18, top + 32, accent);
            context.fill(left + 16, top + 52, left + PANEL_WIDTH - 16, top + 53, 0xFF354254);

            String[] labels = {
                    "OVERHEAD HEARTS",
                    "ARMOR BAR",
                    "ABSORPTION HEARTS",
                    "SHOW YOURSELF",
                    "TRACKING RANGE",
                    "HEART SCALE",
                    "INDICATOR TYPE",
                    "INVISIBLE MARKER",
                    "ACCENT COLOR"
            };
            String[] values = {
                    state(hudEnabled),
                    state(armorEnabled),
                    state(absorptionEnabled),
                    state(showSelf),
                    range + " BLOCKS  (click side to adjust)",
                    new String[]{"SMALL", "STANDARD", "LARGE"}[scaleIndex],
                    new String[]{"CLASSIC", "HEARTS + HP", "COMPACT"}[indicatorStyle],
                    markInvisible ? "SHOW VEILED TAG" : "HIDE TAG ONLY",
                    new String[]{"MINT", "VIOLET", "AMBER"}[accentIndex]
            };

            for (int i = 0; i < ROW_COUNT; i++) {
                int rowY = top + ROW_START + i * ROW_HEIGHT;
                boolean hovered = mouseX >= left + 16 && mouseX < left + PANEL_WIDTH - 16 && mouseY >= rowY && mouseY < rowY + 23;
                context.fill(left + 16, rowY, left + PANEL_WIDTH - 16, rowY + 23, hovered ? 0xFF263446 : 0xFF1A2532);
                context.drawTextWithShadow(textRenderer, labels[i], left + 25, rowY + 7, 0xFFE7EDF4);
                int valueColor = i < 4 && (i == 0 ? hudEnabled : i == 1 ? armorEnabled : i == 2 ? absorptionEnabled : showSelf)
                        ? 0xFF70E2AC : 0xFF9BA9BA;
                if (i == 7) {
                    valueColor = markInvisible ? 0xFFBD78FF : 0xFF9BA9BA;
                } else if (i == 6 || i == 8) {
                    valueColor = accent;
                }
                int valueWidth = textRenderer.getWidth(values[i]);
                context.drawTextWithShadow(textRenderer, values[i], left + PANEL_WIDTH - valueWidth - 25, rowY + 7, valueColor);
            }

            int footerY = top + ROW_START + ROW_COUNT * ROW_HEIGHT + 9;
            context.drawTextWithShadow(textRenderer, "INVISIBLE PLAYERS STILL SHOW THEIR HEARTS", left + 18, footerY, 0xFFBFCBDD);
            context.drawTextWithShadow(textRenderer, "ESC TO CLOSE  /  H TO REOPEN", left + 18, footerY + 15, 0xFF7F8DA0);
            int buttonLeft = left + PANEL_WIDTH - 100;
            int buttonTop = top + PANEL_HEIGHT - 36;
            context.fill(buttonLeft, buttonTop, left + PANEL_WIDTH - 16, buttonTop + 22, accent);
            context.drawCenteredTextWithShadow(textRenderer, "DONE", (buttonLeft + left + PANEL_WIDTH - 16) / 2, buttonTop + 7, 0xFF101820);
        }

        @Override
        public boolean mouseClicked(Click click, boolean doubled) {
            if (click.button() != 0) {
                return false;
            }

            int left = (width - PANEL_WIDTH) / 2;
            int top = (height - PANEL_HEIGHT) / 2;
            int x = (int) click.x();
            int y = (int) click.y();
            int buttonTop = top + PANEL_HEIGHT - 36;
            if (x >= left + PANEL_WIDTH - 100 && x <= left + PANEL_WIDTH - 16 && y >= buttonTop && y <= buttonTop + 22) {
                client.setScreen(null);
                return true;
            }

            int rowIndex = (y - (top + ROW_START)) / ROW_HEIGHT;
            if (x < left + 16 || x >= left + PANEL_WIDTH - 16 || rowIndex < 0 || rowIndex >= ROW_COUNT) {
                return true;
            }

            switch (rowIndex) {
                case 0 -> hudEnabled = !hudEnabled;
                case 1 -> armorEnabled = !armorEnabled;
                case 2 -> absorptionEnabled = !absorptionEnabled;
                case 3 -> showSelf = !showSelf;
                case 4 -> range = Math.max(8, Math.min(96, range + (x < width / 2 ? -8 : 8)));
                case 5 -> scaleIndex = cycle(scaleIndex, 3, x < width / 2);
                case 6 -> indicatorStyle = cycle(indicatorStyle, 3, x < width / 2);
                case 7 -> markInvisible = !markInvisible;
                case 8 -> accentIndex = cycle(accentIndex, ACCENTS.length, x < width / 2);
                default -> {
                }
            }
            return true;
        }

        private static int cycle(int value, int count, boolean backwards) {
            return (value + (backwards ? count - 1 : 1)) % count;
        }

        private static String state(boolean enabled) {
            return enabled ? "ON" : "OFF";
        }
    }
}