package fun.ellant.ui.display.impl;
import com.mojang.blaze3d.matrix.MatrixStack;
import fun.ellant.Initilization;
import fun.ellant.events.EventDisplay;
import fun.ellant.modules.impl.hud.HUD;import fun.ellant.ui.display.ElementRenderer;
import fun.ellant.ui.styles.Style;
import fun.ellant.utils.player.HelperUtil;
import fun.ellant.utils.client.ServerTPS;
import fun.ellant.utils.render.ColorUtils;
import fun.ellant.utils.render.DisplayUtils;
import fun.ellant.utils.render.font.Fonts;
import fun.ellant.utils.text.GradientUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.ITextComponent;
import java.text.SimpleDateFormat;
import java.util.Date;
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class WatermarkRendererNur implements ElementRenderer {
@Override
public void render(EventDisplay eventDisplay) {
MatrixStack ms = eventDisplay.getMatrixStack();
float posX = 5;
float posY = 4;
float padding = 5;
float fontSize = 6.5f;
float iconSize = 10;
float posX1 = 65;
float posY1 = 4;
Style style = Initilization.getEllant().getStyleManager().getCurrentStyle();
String fps1 = String.valueOf(mc.debugFPS);
drawStyledRect(posX, posY, iconSize + padding * 9, iconSize + padding * 1.3f, 4);
DisplayUtils.drawRectVerticalW(posX + 17.5f, posY + 3.5f, 0.5f, 7, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
Fonts.sfMedium.drawText(ms, "Release", posX + 19.5f, posY + 3.5f, HUD.getColor(0), fontSize);
Fonts.wasafont.drawText(ms, "U", posX + 4.0f, posY + 2f, HUD.getColor(0), fontSize + 3.5f);
int fps = mc.getDebugFPS();
ITextComponent fpsText = GradientUtil.gradient(String.valueOf(fps));
float fpsTextWidth = Fonts.sfMedium.getWidth(fpsText, fontSize);
float fpsPosX = posX + iconSize + padding * 3;
if (fps >= 100 && fps <= 999) {
posX1 += 5;
}
String bps = (int) mc.player.getPosX() + " " + (int) mc.player.getPosY() + " " + (int) mc.player.getPosZ();
String tps = String.valueOf(ServerTPS.getTPS());
String bpsget = String.valueOf(HelperUtil.calculateBPS());
String name = mc.player.getName().getString();
float namewidht = Fonts.sfMedium.getWidth(name, fontSize);
float fpsTextWidth1 = Fonts.sfMedium.getWidth(bps, fontSize);
float fpsWidth = Fonts.sfMedium.getWidth(String.valueOf(fps), fontSize);
drawStyledRect(posX + 0.1f, posY + 15, iconSize + padding * 3.2f + fpsTextWidth1, iconSize + padding * 1.3f, 4);
DisplayUtils.drawRectVerticalW(posX + 13.9f, posY + 18.0f, 0.5f, 7, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), bps, posX + 18, posY + 18.8f, ColorUtils.rgb(210, 210, 210), fontSize, 0.05f);
Fonts.wasafont.drawText(eventDisplay.getMatrixStack(), "S", posX + 4, posY + 18.1f, HUD.getColor(0), fontSize + 1, 0.05f);
drawStyledRect(posX + 23 + fpsTextWidth1, posY + 15, iconSize + padding * 9.5f, iconSize + padding * 1.3f, 4);
DisplayUtils.drawRectVerticalW(posX + 37 + fpsTextWidth1, posY + 18.0f, 0.5f, 7, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), tps + " Ticks", posX + 40 + fpsTextWidth1, posY + 18.8f, ColorUtils.rgb(210, 210, 210), fontSize - 0.4f, 0.05f);
Fonts.wasafont.drawText(eventDisplay.getMatrixStack(), tps + "V", posX + 27 + fpsTextWidth1, posY + 18.1f, HUD.getColor(0), fontSize + 1, 0.05f);
drawStyledRect(posX + 78 + fpsTextWidth1, posY + 15, iconSize + padding * 10f, iconSize + padding * 1.3f, 4);
DisplayUtils.drawRectVerticalW(posX + 93 + fpsTextWidth1, posY + 18.0f, 0.5f, 7, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), bpsget + " BPS", posX + 96 + fpsTextWidth1, posY + 18.8f, ColorUtils.rgb(210, 210, 210), fontSize - 0.2f, 0.05f);
Fonts.wasafont.drawText(eventDisplay.getMatrixStack(), tps + "M", posX + 82 + fpsTextWidth1, posY + 18.1f, HUD.getColor(0), fontSize + 1, 0.05f);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String timeString = sdf.format(new Date());
String time = timeString;
float timeTextWidth = Fonts.sfui.getWidth(time, fontSize);
drawStyledRect(posX + 52.1f, posY + 0, iconSize + padding + 50 + namewidht + fpsWidth + timeTextWidth + 3f, iconSize + padding * 1.3f, 4);
DisplayUtils.drawRectVerticalW(posX + 97.9f + +namewidht + fpsWidth, posY + 3.0f, 0.5f, 7, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
DisplayUtils.drawRectVerticalW(posX + 66.9f + +namewidht, posY + 3.0f, 0.5f, 7, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), name, posX + 64, posY + 3.5f, ColorUtils.rgb(210, 210, 210), fontSize, 0.05f);
Fonts.wasafont.drawText(eventDisplay.getMatrixStack(), tps + "O", posX + 55, posY + 3.1f, HUD.getColor(0), fontSize + 1, 0.05f);
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), fps + " Fps", posX + 80 + namewidht, posY + 3.5f, ColorUtils.rgba(210, 210, 210, 255), fontSize + 0, 0.05f);
Fonts.wasafont.drawText(eventDisplay.getMatrixStack(), tps + "P", posX + 70 + namewidht, posY + 3.1f, HUD.getColor(0), fontSize + 1, 0.05f);
Fonts.wasafont.drawText(eventDisplay.getMatrixStack(), tps + "N", posX + 101 + namewidht + fpsWidth, posY + 3.1f, HUD.getColor(0), fontSize + 1, 0.05f);
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), time, posX + 113 + namewidht + fpsWidth, posY + 3.5f, ColorUtils.rgba(210, 210, 210, 255), fontSize + 0, 0.05f);
}
private void drawStyledRect(float x, float y, float width, float height, float radius) {
DisplayUtils.drawRoundedRect(x, y, width + -4, height + -3, radius, ColorUtils.rgba(0, 0, 0, 100));
DisplayUtils.drawRoundedRect(x, y, width + -4, height + -3, radius, ColorUtils.rgba(0, 0, 0, 100));
DisplayUtils.drawShadow(x, y, width + -4, height + -3, (int) radius, ColorUtils.rgba(0, 0, 0, 40));
DisplayUtils.drawShadow(x, y, width + -4, height + -3, (int) radius, ColorUtils.rgba(0, 0, 0, 40));
}
}