Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Визуальная часть Watermark Rich 1.21.11

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
24 Июл 2025
Сообщения
22
Реакции
0
Выберите загрузчик игры
  1. Fabric
первая работа не судите строго, там не адаптируется под длинну юзернейма т. к. не знал как это сделать
Screenshot_32.png


Code:
Expand Collapse Copy
package rich.screens.hud;

import antidaunleak.api.UserProfile;
import net.minecraft.client.gui.DrawContext;
import rich.client.draggables.AbstractHudElement;
import rich.util.render.Render2D;
import rich.util.render.font.Fonts;

import java.awt.*;

public class Watermark extends AbstractHudElement {

    public Watermark() {
        super("Watermark", 10, 10, 257, 26, false);
        startAnimation();
    }

    @Override
    public void tick() {
    }

    @Override
    public void drawDraggable(DrawContext context, int alpha) {
        if (alpha <= 0) return;

        float x = getX();
        float y = getY();
        float width = 140f;
        float height = 16f;
        float padding = 5;
        float fontSize = 7.5f;

        String username = mc.getSession().getUsername();
        String role = UserProfile.getInstance().profile("role");
        String fpsText = String.valueOf(mc.getCurrentFps());
        String msText = "0";
        if (mc.getCurrentServerEntry() != null) {
            msText = String.valueOf(mc.getCurrentServerEntry().ping);
        }

        int[] gradientColors = {
            new Color(48, 47, 57, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(48, 47, 57, 255).getRGB()
        };

        Render2D.gradientRect(x, y, width, height, gradientColors, 3);

        float textX = x + padding;
        float textY = y + (height - Fonts.BOLD.getHeight(fontSize)) / 2;

        Fonts.ICONS.draw("A", textX, textY + 0.5f, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.ICONS.getWidth("A", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(username, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(username, fontSize) + 2;

        Fonts.TEST.draw("[", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("[", fontSize + 1);

        Fonts.BOLD.draw(role, textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth(role, fontSize);

        Fonts.TEST.draw("]", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("]", fontSize + 1) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(fpsText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(fpsText, fontSize);

        Fonts.BOLD.draw("FPS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth("FPS", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize) + 3;

        Fonts.BOLD.draw(msText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(msText, fontSize);

        Fonts.BOLD.draw("MS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());

        setWidth((int) width);
        setHeight((int) height);
    }
}
 
Последнее редактирование:
первая работа не судите строго, там не адаптируется под длинну юзернейма т. к. не знал как это сделать
Посмотреть вложение 327936

Code:
Expand Collapse Copy
package rich.screens.hud;

import antidaunleak.api.UserProfile;
import net.minecraft.client.gui.DrawContext;
import rich.client.draggables.AbstractHudElement;
import rich.util.render.Render2D;
import rich.util.render.font.Fonts;

import java.awt.*;

public class Watermark extends AbstractHudElement {

    public Watermark() {
        super("Watermark", 10, 10, 257, 26, false);
        startAnimation();
    }

    @Override
    public void tick() {
    }

    @Override
    public void drawDraggable(DrawContext context, int alpha) {
        if (alpha <= 0) return;

        float x = getX();
        float y = getY();
        float width = 140f;
        float height = 16f;
        float padding = 5;
        float fontSize = 7.5f;

        String username = mc.getSession().getUsername();
        String role = UserProfile.getInstance().profile("role");
        String fpsText = String.valueOf(mc.getCurrentFps());
        String msText = "0";
        if (mc.getCurrentServerEntry() != null) {
            msText = String.valueOf(mc.getCurrentServerEntry().ping);
        }

        int[] gradientColors = {
            new Color(48, 47, 57, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(48, 47, 57, 255).getRGB()
        };

        Render2D.gradientRect(x, y, width, height, gradientColors, 3);

        float textX = x + padding;
        float textY = y + (height - Fonts.BOLD.getHeight(fontSize)) / 2;

        Fonts.ICONS.draw("A", textX, textY + 0.5f, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.ICONS.getWidth("A", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(username, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(username, fontSize) + 2;

        Fonts.TEST.draw("[", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("[", fontSize + 1);

        Fonts.BOLD.draw(role, textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth(role, fontSize);

        Fonts.TEST.draw("]", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("]", fontSize + 1) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(fpsText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(fpsText, fontSize);

        Fonts.BOLD.draw("FPS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth("FPS", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize) + 3;

        Fonts.BOLD.draw(msText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(msText, fontSize);

        Fonts.BOLD.draw("MS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());

        setWidth((int) width);
        setHeight((int) height);
    }
}
Ну бля, я понимаю что 1 работа, но можно же было хоть нейронку попросить сделать так чтобы ширина была динамической.
 
Ну бля, я понимаю что 1 работа, но можно же было хоть нейронку попросить сделать так чтобы ширина была динамической.
как же сложно чтобы рект рендерился число + ник + пинг + фпс и тд и вообще зачем делать это через апи кодека если от этого нету смысла если вы не на его проте
первая работа не судите строго, там не адаптируется под длинну юзернейма т. к. не знал как это сделать
Посмотреть вложение 327936

Code:
Expand Collapse Copy
package rich.screens.hud;

import antidaunleak.api.UserProfile;
import net.minecraft.client.gui.DrawContext;
import rich.client.draggables.AbstractHudElement;
import rich.util.render.Render2D;
import rich.util.render.font.Fonts;

import java.awt.*;

public class Watermark extends AbstractHudElement {

    public Watermark() {
        super("Watermark", 10, 10, 257, 26, false);
        startAnimation();
    }

    @Override
    public void tick() {
    }

    @Override
    public void drawDraggable(DrawContext context, int alpha) {
        if (alpha <= 0) return;

        float x = getX();
        float y = getY();
        float width = 140f;
        float height = 16f;
        float padding = 5;
        float fontSize = 7.5f;

        String username = mc.getSession().getUsername();
        String role = UserProfile.getInstance().profile("role");
        String fpsText = String.valueOf(mc.getCurrentFps());
        String msText = "0";
        if (mc.getCurrentServerEntry() != null) {
            msText = String.valueOf(mc.getCurrentServerEntry().ping);
        }

        int[] gradientColors = {
            new Color(48, 47, 57, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(48, 47, 57, 255).getRGB()
        };

        Render2D.gradientRect(x, y, width, height, gradientColors, 3);

        float textX = x + padding;
        float textY = y + (height - Fonts.BOLD.getHeight(fontSize)) / 2;

        Fonts.ICONS.draw("A", textX, textY + 0.5f, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.ICONS.getWidth("A", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(username, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(username, fontSize) + 2;

        Fonts.TEST.draw("[", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("[", fontSize + 1);

        Fonts.BOLD.draw(role, textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth(role, fontSize);

        Fonts.TEST.draw("]", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("]", fontSize + 1) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(fpsText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(fpsText, fontSize);

        Fonts.BOLD.draw("FPS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth("FPS", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize) + 3;

        Fonts.BOLD.draw(msText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(msText, fontSize);

        Fonts.BOLD.draw("MS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());

        setWidth((int) width);
        setHeight((int) height);
    }
}


смотри чтобы тебе сделать адапт длину надо писать не так width = 140 а например width = 30 + username + fps + role и вуаля
 
как же сложно чтобы рект рендерился число + ник + пинг + фпс и тд и вообще зачем делать это через апи кодека если от этого нету смысла если вы не на его проте



смотри чтобы тебе сделать адапт длину надо писать не так width = 140 а например width = 30 + username + fps + role и вуаля
спасибо
 
как же сложно чтобы рект рендерился число + ник + пинг + фпс и тд и вообще зачем делать это через апи кодека если от этого нету смысла если вы не на его проте



смотри чтобы тебе сделать адапт длину надо писать не так width = 140 а например width = 30 + username + fps + role и вуаля
Да я то умею, а он новичек
ты можешь это и сам сделать
Так я новичку советы даю, я такое уже давно умею
 
первая работа не судите строго, там не адаптируется под длинну юзернейма т. к. не знал как это сделать
Посмотреть вложение 327936

Code:
Expand Collapse Copy
package rich.screens.hud;

import antidaunleak.api.UserProfile;
import net.minecraft.client.gui.DrawContext;
import rich.client.draggables.AbstractHudElement;
import rich.util.render.Render2D;
import rich.util.render.font.Fonts;

import java.awt.*;

public class Watermark extends AbstractHudElement {

    public Watermark() {
        super("Watermark", 10, 10, 257, 26, false);
        startAnimation();
    }

    @Override
    public void tick() {
    }

    @Override
    public void drawDraggable(DrawContext context, int alpha) {
        if (alpha <= 0) return;

        float x = getX();
        float y = getY();
        float width = 140f;
        float height = 16f;
        float padding = 5;
        float fontSize = 7.5f;

        String username = mc.getSession().getUsername();
        String role = UserProfile.getInstance().profile("role");
        String fpsText = String.valueOf(mc.getCurrentFps());
        String msText = "0";
        if (mc.getCurrentServerEntry() != null) {
            msText = String.valueOf(mc.getCurrentServerEntry().ping);
        }

        int[] gradientColors = {
            new Color(48, 47, 57, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(0x11, 0x11, 0x11, 255).getRGB(),
            new Color(48, 47, 57, 255).getRGB()
        };

        Render2D.gradientRect(x, y, width, height, gradientColors, 3);

        float textX = x + padding;
        float textY = y + (height - Fonts.BOLD.getHeight(fontSize)) / 2;

        Fonts.ICONS.draw("A", textX, textY + 0.5f, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.ICONS.getWidth("A", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(username, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(username, fontSize) + 2;

        Fonts.TEST.draw("[", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("[", fontSize + 1);

        Fonts.BOLD.draw(role, textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth(role, fontSize);

        Fonts.TEST.draw("]", textX, textY - 1f, fontSize + 1, new Color(141, 140, 143, 255).getRGB());
        textX += Fonts.TEST.getWidth("]", fontSize + 1) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize + 1) + 3;

        Fonts.BOLD.draw(fpsText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(fpsText, fontSize);

        Fonts.BOLD.draw("FPS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());
        textX += Fonts.BOLD.getWidth("FPS", fontSize) + 3;

        Fonts.TEST.draw("•", textX, textY - 0.5f, fontSize + 1, new Color(0x4b, 0x4b, 0x50, 255).getRGB());
        textX += Fonts.TEST.getWidth("•", fontSize) + 3;

        Fonts.BOLD.draw(msText, textX, textY, fontSize, new Color(255, 255, 255, 255).getRGB());
        textX += Fonts.BOLD.getWidth(msText, fontSize);

        Fonts.BOLD.draw("MS", textX, textY, fontSize, new Color(0xA3, 0x9B, 0xD6, 255).getRGB());

        setWidth((int) width);
        setHeight((int) height);
    }
}
выглядит неплохо для первой работы красавчик
 
Назад
Сверху Снизу