- Выберите загрузчик игры
- Прочие моды
я незнаю что я сделал, но мб кому то зайдет
ss(прикреп)
Код:
ss(прикреп)
Код:
JavaScript:
package log.evcalipse.ui.display.impl;
import log.evcalipse.events.EventDisplay;
import log.evcalipse.ui.display.ElementRenderer;
import log.evcalipse.utils.drag.Dragging;
import log.evcalipse.utils.render.color.ColorUtils;
import log.evcalipse.utils.render.font.Fonts;
import log.evcalipse.utils.render.rect.RenderUtility;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.util.math.vector.Vector4f;
import org.lwjgl.opengl.GL11;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class WatermarkRenderer implements ElementRenderer {
private final Dragging dragging;
private static final Minecraft mc = Minecraft.getInstance();
private final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
private float waveOffset = 0;
public WatermarkRenderer(Dragging dragging) {
this.dragging = dragging;
}
@Override
public void render(EventDisplay eventDisplay) {
MatrixStack ms = eventDisplay.getMatrixStack();
float posX = dragging.getX();
float posY = dragging.getY();
float fontSize = 8f;
float titleFontSize = 9f;
waveOffset += 0.02f;
int accentColor = interpolateColor(ColorUtils.rgba(0, 150, 255, 255),
ColorUtils.rgba(100, 200, 255, 255),
(float) (Math.sin(waveOffset) * 0.5f + 0.5f));
String titleText = "Evcalipse";
String infoText = String.format("%d FPS | %d ms | %s",
mc.debugFPS,
getPing(),
getCurrentMskTime());
float titleWidth = Fonts.sfbold.getWidth(titleText, titleFontSize);
float infoWidth = Fonts.sfuy.getWidth(infoText, fontSize);
float padding = 8f;
float totalWidth = Math.max(titleWidth, infoWidth) + padding * 2;
float lineHeight = 12f;
float totalHeight = lineHeight * 2;
float cornerRadius = 6f;
GL11.glPushMatrix();
GL11.glTranslatef(posX, posY, 0);
int backgroundColor = ColorUtils.rgba(15, 15, 20, 200);
RenderUtility.drawRoundedRect(0, 0, totalWidth, totalHeight,
new Vector4f(cornerRadius, cornerRadius, cornerRadius, cornerRadius),
backgroundColor);
RenderUtility.drawRect(0, 0, 1.5f, totalHeight, accentColor);
float titleY = (lineHeight - titleFontSize) / 2 + 1f;
float infoY = lineHeight + (lineHeight - fontSize) / 2 + 1f;
Fonts.sfbold.drawText(ms, titleText, padding, titleY, accentColor, titleFontSize);
Fonts.sfuy.drawText(ms, infoText, padding, infoY, ColorUtils.rgba(255, 255, 255, 255), fontSize);
GL11.glPopMatrix();
dragging.setWidth(totalWidth);
dragging.setHeight(totalHeight);
}
private int interpolateColor(int color1, int color2, float progress) {
progress = Math.max(0, Math.min(1, progress));
int r1 = (color1 >> 16) & 0xFF;
int g1 = (color1 >> 8) & 0xFF;
int b1 = color1 & 0xFF;
int a1 = (color1 >> 24) & 0xFF;
int r2 = (color2 >> 16) & 0xFF;
int g2 = (color2 >> 8) & 0xFF;
int b2 = color2 & 0xFF;
int a2 = (color2 >> 24) & 0xFF;
int r = (int) (r1 + (r2 - r1) * progress);
int g = (int) (g1 + (g2 - g1) * progress);
int b = (int) (b1 + (b2 - b1) * progress);
int a = (int) (a1 + (a2 - a1) * progress);
return (a << 24) | (r << 16) | (g << 8) | b;
}
private int getPing() {
return mc.getConnection() != null ?
mc.getConnection().getPlayerInfo(mc.player.getUniqueID()).getResponseTime() : 0;
}
private String getCurrentMskTime() {
return ZonedDateTime.now(ZoneId.of("Europe/Moscow")).format(timeFormatter);
}
}