Начинающий
- Статус
- Оффлайн
- Регистрация
- 11 Июн 2025
- Сообщения
- 11
- Реакции
- 0
+rep, кайфСкид meowdlc, вроде норм, пишите что не так
Пожалуйста, авторизуйтесь для просмотра ссылки.
code:package fun.rich.display.hud; import fun.rich.features.impl.render.Hud; import com.google.common.base.Suppliers; import fun.rich.utils.client.managers.api.draggable.AbstractDraggable; import fun.rich.utils.display.atlasfont.msdf.MsdfFont; import fun.rich.utils.display.font.Fonts; import fun.rich.utils.display.shape.ShapeProperties; import fun.rich.utils.display.systemrender.builders.Builder; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.math.MatrixStack; import org.joml.Matrix4f; import java.awt.Color; import java.util.function.Supplier; public class Watermark extends AbstractDraggable { private int fpsCount = 0; private static final Supplier<MsdfFont> ICONS_FONT = Suppliers.memoize(() -> MsdfFont.builder().atlas("icons").data("icons").build()); public Watermark() { super("Watermark", 10, 10, 120, 14, true); } @Override public void tick() { fpsCount = MinecraftClient.getInstance().getCurrentFps(); } @Override public void drawDraggable(DrawContext e) { if (mc.player == null || mc.world == null) return; MatrixStack matrix = e.getMatrices(); Matrix4f matrix4f = matrix.peek().getPositionMatrix(); Hud hud = Hud.getInstance(); String icon = "W"; String point = " • "; String clientName = " Арктик"; String username = " [" + "Пользователь" + "]"; int white = -1; int grayText = new Color(150, 150, 150, 255).getRGB(); int dotColor = new Color(180, 180, 200, 255).getRGB(); float iconWidth = ICONS_FONT.get().getWidth(icon, 12); float clientNameWidth = Fonts.getSize(14, Fonts.Type.BOLD).getStringWidth(clientName); float usernameWidth = Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth(username); float pointWidth = Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth(point); float totalWidth = 5 + iconWidth + 2 + pointWidth + clientNameWidth + usernameWidth; boolean showPing = hud.watermarkElements.isSelected("Ping"); boolean showFps = hud.watermarkElements.isSelected("FPS"); String pingVal = String.valueOf(calculatePing()); String fpsVal = String.valueOf(fpsCount); if (showPing) { totalWidth += pointWidth + Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth(pingVal + "ms"); } if (showFps) { totalWidth += pointWidth + Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth(fpsVal + "fps"); } totalWidth += 5; float bgHeight = 14f; setWidth((int) totalWidth); setHeight((int) bgHeight); blur.render(ShapeProperties.create(matrix, getX(), getY(), totalWidth, bgHeight) .round(3f).quality(12).color(new Color(20, 20, 25, 220).getRGB()).build()); rectangle.render(ShapeProperties.create(matrix, getX(), getY(), totalWidth, bgHeight) .round(3f).thickness(0.5f).outlineColor(new Color(40, 40, 45, 100).getRGB()) .color(new Color(25, 26, 28, 180).getRGB()).build()); float text14Height = 7.0f; float centerY = getY() + (bgHeight / 2f) - (text14Height / 2f) + 1.5f; float currentX = getX() + 5; Builder.text().font(ICONS_FONT.get()).text(icon).size(12).color(new Color(225, 225, 255, 255).getRGB()) .build().render(matrix4f, currentX, getY() + (bgHeight / 12f) - (6f / 2f)); currentX += iconWidth + 2; Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, point, currentX, centerY, dotColor); currentX += pointWidth; Fonts.getSize(14, Fonts.Type.BOLD).drawString(matrix, clientName, currentX, centerY, white); currentX += clientNameWidth; Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, username, currentX, centerY, new Color(160, 160, 180, 255).getRGB()); currentX += usernameWidth; if (showFps) { Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, point, currentX, centerY, dotColor); currentX += pointWidth; Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, fpsVal, currentX, centerY, white); currentX += Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth(fpsVal); Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, "fps", currentX, centerY, grayText); currentX += Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth("fps"); } if (showPing) { Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, point, currentX, centerY, dotColor); currentX += pointWidth; Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, pingVal, currentX, centerY, white); currentX += Fonts.getSize(14, Fonts.Type.DEFAULT).getStringWidth(pingVal); Fonts.getSize(14, Fonts.Type.DEFAULT).drawString(matrix, "ms", currentX, centerY, grayText); } } private int calculatePing() { if (mc.getNetworkHandler() != null && mc.player != null) { var entry = mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()); if (entry != null) return entry.getLatency(); } return 0; } }