upd: сделал другой стаффлист ss list: ss hud: dw hud dw icons package im.Moonlight.ui.display.impl; import com.mojang.blaze3d.matrix.MatrixStack; import im.Moonlight.Moonlight; import im.Moonlight.command.staffs.StaffStorage; import im.Moonlight.events.EventDisplay; import im.Moonlight.events.EventUpdate; import im.Moonlight.ui.display.ElementRenderer; import im.Moonlight.ui.display.ElementUpdater; import im.Moonlight.ui.styles.Style; import im.Moonlight.utils.drag.Dragging; import im.Moonlight.utils.math.MathUtil; import im.Moonlight.utils.render.ColorUtils; import im.Moonlight.utils.render.DisplayUtils; import im.Moonlight.utils.render.KawaseBlur; import im.Moonlight.utils.render.font.Fonts; import im.Moonlight.utils.text.GradientUtil; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.experimental.FieldDefaults; import net.minecraft.client.network.play.NetworkPlayerInfo; import net.minecraft.scoreboard.ScorePlayerTeam; import net.minecraft.scoreboard.Team; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.GameType; import ru.hogoshi.Animation; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Locale; import java.util.regex.Pattern; @FieldDefaults(level = AccessLevel.PRIVATE) @RequiredArgsConstructor public class StaffListRenderer2 implements ElementRenderer, ElementUpdater { private float animation; final Dragging dragging; final ResourceLocation logo = new ResourceLocation("expensive/images/hud/staff1.png"); final float iconSize = 10; private final List<Staff> staffPlayers = new ArrayList<>(); private final Pattern namePattern = Pattern.compile("^\\w{3,16}$"); private final Pattern prefixMatches = Pattern.compile(".(mod|der|adm|help|wne|хелп|адм|поддержка|кура|own|taf|curat|dev|supp|yt|сотруд)."); @Override public void update(EventUpdate e) { staffPlayers.clear(); for (ScorePlayerTeam team : mc.world.getScoreboard().getTeams().stream().sorted(Comparator.comparing(Team::getName)).toList()) { String name = team.getMembershipCollection().toString().replaceAll("[\\[\\]]", ""); boolean vanish = true; for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) { if (info.getGameProfile().getName().equals(name)) { vanish = false; } } if (namePattern.matcher(name).matches() && !name.equals(mc.player.getName().getString())) { if (!vanish) { if (prefixMatches.matcher(team.getPrefix().getString().toLowerCase(Locale.ROOT)).matches() || StaffStorage.isStaff(name)) { Staff staff = new Staff(team.getPrefix(), name, false); staffPlayers.add(staff); } } if (vanish && !team.getPrefix().getString().isEmpty()) { Staff staff = new Staff(team.getPrefix(), name, true); staffPlayers.add(staff); } } } } float width; float height; @Override public void render(EventDisplay eventDisplay) { float posX = dragging.getX(); float posY = dragging.getY(); float padding = 5; float fontSize = 6.5f; MatrixStack ms = eventDisplay.getMatrixStack(); ITextComponent name = GradientUtil.gradient("Employees"); Style style = Moonlight.getInstance().getStyleManager().getCurrentStyle(); //DisplayUtils.drawShadow(posX, posY, width, height, 10, style.getFirstColor().getRGB(), style.getSecondColor().getRGB()); DisplayUtils.drawRoundedRect(posX, posY + 1.0f, this.animation, 18.0f, 4.0f, ColorUtils.rgba(21, 21, 21, 215)); DisplayUtils.drawImage(logo, posX + padding, posY + padding, iconSize, iconSize, ColorUtils.rgb(255, 255, 255)); Fonts.sfui.drawText(ms, "Employees", posX + 20, posY + padding + 1.5f,ColorUtils.rgb(255,255,255), 6.5f); posY += fontSize + padding * 2; float maxWidth = Fonts.sfMedium.getWidth(name, fontSize) + padding * 2; float localHeight = fontSize + padding * 2; //DisplayUtils.drawRectHorizontalW(posX + 0.5f, posY, width - 1, 2.5f, 3, ColorUtils.rgba(255, 255, 255, (int) (255 * 0.25f))); DisplayUtils.drawRectVerticalW(posX + 18.0f, posY - 13.5f, 1, 14.0f, 3, ColorUtils.rgba(255, 255, 255, (int) (255 * 0.75f))); posY += 3.5f; for (StaffListRenderer2.Staff f : staffPlayers) { ITextComponent prefix = f.getPrefix(); float prefixWidth = Fonts.sfMedium.getWidth(prefix, fontSize); String staff = (prefix.getString().isEmpty() ? "" : " ") + f.getName(); float nameWidth = Fonts.sfMedium.getWidth(staff, fontSize); float localWidth = prefixWidth + nameWidth + padding * 3; DisplayUtils.drawRoundedRect(posX, posY, this.animation, 12.0f, 3.0f, ColorUtils.rgba(21, 21, 21,215)); Fonts.sfMedium.drawText(ms, prefix, posX + padding, posY + 2.5f, fontSize, 255); Fonts.sfMedium.drawText(ms, staff, posX + padding + prefixWidth, posY + 2.5f, ColorUtils.rgb(255,255,255), fontSize); //Fonts.sfMedium.drawText(ms, f.getStatus().string, posX + width - padding - Fonts.sfMedium.getWidth(f.getStatus().string, fontSize), posY, f.getStatus().color, fontSize); if (f.isVanished()) { DisplayUtils.drawCircle(posX + 4 + width - padding - fontSize / 2, posY + fontSize / 2 + 2.5f, fontSize / 2 + 2, ColorUtils.rgb(254, 68, 68)); } else { DisplayUtils.drawCircle(posX + 4 + width - padding - fontSize / 2, posY + fontSize / 2 + 2.5f, fontSize / 2 + 2, ColorUtils.rgb(0, 255, 0)); } if (localWidth > maxWidth) { maxWidth = localWidth; } posY += fontSize + padding; localHeight += fontSize + padding; } this.animation = MathUtil.lerp(this.animation, Math.max(maxWidth, 80.0f), 10.0f); this.height = localHeight + 2.5f; this.dragging.setWidth(this.animation); this.dragging.setHeight(this.height); width = Math.max(maxWidth, 80); height = localHeight + 2.5f; dragging.setWidth(width); dragging.setHeight(height); } @AllArgsConstructor @data public class Staff { ITextComponent prefix; String name; boolean isVanished; public void updateStatus() { for (NetworkPlayerInfo info : mc.getConnection().getPlayerInfoMap()) { if (info.getGameProfile().getName().equals(name)) { if (info.getGameType() == GameType.SPECTATOR) { return; } isVanished = false; return; } } isVanished = true; } } public enum Status { NONE("", -1), VANISHED("V", ColorUtils.rgb(254, 68, 68)); public final String string; public final int color; Status(String string, int color) { this.string = string; this.color = color; } } private void drawStyledRect(float x, float y, float width, float height, float radius) { //DisplayUtils.drawRoundedRect(x - 0.5f, y - 0.5f, width + 1, height + 1, radius + 0.5f, ColorUtils.getColor(0)); // outline DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(21, 21, 21, 215)); } }