Начинающий
- Статус
- Оффлайн
- Регистрация
- 12 Июн 2025
- Сообщения
- 120
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
впервые решил заняться худ элементами и чет такое слепил там немног подравить и норм будет
waternark:
package wtf.execution.implement.features.draggables;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.util.math.MatrixStack;
import wtf.execution.api.feature.draggable.AbstractDraggable;
import wtf.execution.api.system.font.FontRenderer;
import wtf.execution.api.system.font.Fonts;
import wtf.execution.api.system.shape.ShapeProperties;
import wtf.execution.common.util.color.ColorUtil;
import wtf.execution.common.util.math.MathUtil;
import wtf.execution.common.util.other.StringUtil;
import wtf.execution.core.Main;
public class Watermark extends AbstractDraggable {
private int fpsCount = 0;
private int ping = 0;
public Watermark() {
super("Watermark", 10, 10, 120, 28, true);
}
@Override
public void tick() {
fpsCount = (int) MathUtil.interpolate(fpsCount, mc.getCurrentFps());
int currentPing = 0;
if (mc.getNetworkHandler() != null && mc.player != null) {
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid());
if (entry != null) currentPing = entry.getLatency();
}
ping = (int) MathUtil.interpolate(ping, currentPing);
}
@Override
public void drawDraggable(DrawContext e) {
MatrixStack matrix = e.getMatrices();
FontRenderer nameFont = Fonts.getSize(15, Fonts.Type.SEMIBOLD);
FontRenderer infoFont = Fonts.getSize(13, Fonts.Type.SEMIBOLD);
FontRenderer iconFont = Fonts.getSize(13, Fonts.Type.MINCED);
String name = Main.getInstance().getClientInfoProvider().clientName();
String role = StringUtil.getUserRole();
char userIcon = (char) 0x62; // user icon
char fpsIcon = (char) 0x68; // stopwatch
char pingIcon = (char) 0x6F; // wifi
String fpsStr = fpsCount + " FPS";
String pingStr = ping + " ms";
float pad = 6;
float infoLineWidth = nameFont.getStringWidth(name) + pad +
iconFont.getStringWidth(String.valueOf(userIcon)) + 2 +
infoFont.getStringWidth(role) + pad +
iconFont.getStringWidth(String.valueOf(fpsIcon)) + 2 + infoFont.getStringWidth(fpsStr) + pad +
iconFont.getStringWidth(String.valueOf(pingIcon)) + 2 + infoFont.getStringWidth(pingStr);
int calculatedWidth = (int) (infoLineWidth + 12);
float lineHeight = Math.max(nameFont.getStringHeight(name), infoFont.getStringHeight(fpsStr)) / 2f;
int calculatedHeight = (int) (lineHeight + 6);
setWidth(calculatedWidth);
setHeight(calculatedHeight);
blur.render(ShapeProperties.create(matrix, getX(), getY(), calculatedWidth, calculatedHeight)
.round(6).softness(6F).thickness(1.2F)
.outlineColor(ColorUtil.fade(100))
.color(ColorUtil.getRect(0.7F))
.build());
float y = getY() + (calculatedHeight - lineHeight) / 2f + 3;
float x = getX() + 6;
nameFont.drawGradientString(matrix, name, x, y, ColorUtil.fade(0), ColorUtil.fade(100));
x += nameFont.getStringWidth(name) + pad;
float iconY = y + 0.5f;
iconFont.drawString(matrix, String.valueOf(userIcon), x, iconY, ColorUtil.getText());
x += iconFont.getStringWidth(String.valueOf(userIcon)) + 2;
infoFont.drawString(matrix, role, x, y, ColorUtil.getText());
x += infoFont.getStringWidth(role) + pad;
iconFont.drawString(matrix, String.valueOf(fpsIcon), x, iconY, ColorUtil.getText());
x += iconFont.getStringWidth(String.valueOf(fpsIcon)) + 2;
infoFont.drawString(matrix, fpsStr, x, y, ColorUtil.getText());
x += infoFont.getStringWidth(fpsStr) + pad;
iconFont.drawString(matrix, String.valueOf(pingIcon), x, iconY, ColorUtil.getText());
x += iconFont.getStringWidth(String.valueOf(pingIcon)) + 2;
infoFont.drawString(matrix, pingStr, x, y, ColorUtil.getText());
}
}
