Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 2 Янв 2026
- Сообщения
- 6
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
Пожалуйста, авторизуйтесь для просмотра ссылки.
Java:
public class WatermarkWidget extends Widget {
String iconPlayerNick = "U";
String iconFPS = "Y";
String iconPing = "W";
String clientName = "Z";
float height = 19f;
float lineWidth = 1f;
float radius = 6;
float fontSize = 8f;
float padding = 4f;
float gap = 4f;
Color background = new Color(29, 27, 36);
Color icon = new Color(183, 163, 255);
Color forGradient = new Color(97, 88, 138, 1);
Color forGradient2 = new Color(0x141319);
@Override
public String getName() {
return "Watermark";
}
public WatermarkWidget() {
super(3f, 3f);
}
@Override
public String render(MatrixStack matrixStack) {
if (mc.player == null || mc.world == null) return null;
float x = getDraggable().getX();
float y = getDraggable().getY();
String namePlayer = mc.getSession().getUsername();
String currentFPS = String.valueOf(mc.getCurrentFps()) + " fps";
String ping = getPing() + " ms";
float namePlayerWidth = getMediumFont().getWidth(namePlayer, fontSize);
float currentFPSWidth = getMediumFont().getWidth(currentFPS, fontSize);
float pingWidth = getMediumFont().getWidth(ping, fontSize);
float iconPlayerNickWidth = getIconFont().getWidth(iconPlayerNick, fontSize);
float iconFPSWidth = getIconFont().getWidth(iconFPS, fontSize);
float iconPingWidth = getIconFont().getWidth(iconPing, fontSize);
float clientNameWidth = getIconFont().getWidth(clientName, fontSize);
float totalWidth = padding + clientNameWidth + gap + lineWidth + gap +
iconPlayerNickWidth + gap + namePlayerWidth + lineWidth + gap +
iconPingWidth + gap + pingWidth + gap +
iconFPSWidth + gap + currentFPSWidth + gap + gap + padding;
float currentX = x + gap;
float textY = y + (height / 2) - (fontSize / 2);
RenderUtil.RECT.draw(matrixStack, x, y, totalWidth, height, radius, background);
RenderUtil.GRADIENT_RECT.draw(matrixStack, x, y, totalWidth, height, radius, forGradient, forGradient2, forGradient, forGradient2);
getSemiBoldFont().drawText(matrixStack, clientName, currentX, textY, fontSize, icon);
currentX += clientNameWidth + gap;
RenderUtil.RECT.draw(matrixStack, currentX, y, lineWidth, height, 0, new Color(0x32303E));
currentX += lineWidth + gap;
getIconFont().drawText(matrixStack, iconPlayerNick, currentX, textY, fontSize, icon);
currentX += iconPlayerNickWidth + gap;
getMediumFont().drawText(matrixStack, namePlayer, currentX, textY, fontSize, Color.WHITE);
currentX += namePlayerWidth + gap;
RenderUtil.RECT.draw(matrixStack, currentX, y, lineWidth, height, 0, new Color(0x32303E));
currentX += lineWidth + gap;
getIconFont().drawText(matrixStack, iconPing, currentX, textY, fontSize, icon);
currentX += iconPingWidth + gap;
getMediumFont().drawText(matrixStack, ping, currentX, textY, fontSize, Color.WHITE);
currentX += pingWidth + gap;
RenderUtil.RECT.draw(matrixStack, currentX, y, lineWidth, height, 0, new Color(0x32303E));
currentX += lineWidth + gap;
getIconFont().drawText(matrixStack, iconFPS, currentX, textY, fontSize, icon);
currentX += iconFPSWidth + gap;
getMediumFont().drawText(matrixStack, currentFPS, currentX, textY, fontSize, Color.WHITE);
getDraggable().setWidth(totalWidth);
getDraggable().setHeight(height);
return "";
}
private String getPing() {
if (mc.player != null || mc.getNetworkHandler() != null) {
PlayerListEntry playerEntry = mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid());
if (playerEntry != null) {
return String.valueOf(playerEntry.getLatency());
}
}
return "0";
}
}