package im.CloudDLC.ui.display.impl;
import com.mojang.blaze3d.matrix.MatrixStack;
import im.CloudDLC.events.EventDisplay;
import im.CloudDLC.ui.display.ElementRenderer;
import im.CloudDLC.utils.render.ColorUtils;
import im.CloudDLC.utils.render.DisplayUtils;
import im.CloudDLC.utils.render.font.Fonts;
import im.CloudDLC.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 net.minecraft.util.text.StringTextComponent;
import java.text.SimpleDateFormat;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import static im.CloudDLC.functions.impl.movement.FastFall.time;
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class WatermarkRenderer implements ElementRenderer {
final Minecraft mc = Minecraft.getInstance();
public void render(EventDisplay eventDisplay) {
MatrixStack ms = eventDisplay.getMatrixStack();
float posX = 5;
float posY = 4;
float padding = 5;
float STOPjohnPLEASE = 6.5f;
float iconSize = 10;
float namewidht = 0;
drawStyledRect(posX + 0.6f - 0.4f, posY, iconSize + padding + 39 + namewidht, iconSize + padding * 0.5f, 4);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String timeString = sdf.format(new Date());
String time = timeString;
float fpsWidth = 0;
float fontSize = 0;
Fonts.sfMedium.drawText(eventDisplay.getMatrixStack(), time, posX + 95 + namewidht + fpsWidth, posY + 4f, ColorUtils.rgba(210, 210, 210, 255), fontSize + 0, 0.05f);
String fps1 = String.valueOf(mc.debugFPS);
float fpsw = Fonts.sfMedium.getWidth(fps1, 7);
namewidht = 0;
drawStyledRect(posX + 0.6f - 0.4f, posY, iconSize + padding + 39 + namewidht, iconSize + padding * 0.5f, 4);
Fonts.icons2.drawText(ms, "P", posX + 4, posY + 4f, ColorUtils.rgb(255, 255, 255), 7);
drawStyledRect(posX + 64f, posY + 0.3f, fpsw + padding * 6 - 2, iconSize + padding * 0.5f, 4);
drawStyledRect(posX + 64f, posY + 0.3f, fpsw + padding * 6 - 2, iconSize + padding * 0.5f, 4);
drawStyledRect(posX + 64f, posY + 0.3f, fpsw + padding * 6 - 2, iconSize + padding * 0.5f, 4);
Fonts.sfMedium.drawText(ms, fps1 + "FPS", posX + 77f, posY + 3.4f, ColorUtils.rgb(255, 255, 255), 7);
Fonts.wasafont.drawText(ms, "P", posX + 66f, posY + 3.4f, ColorUtils.rgb(255, 255, 255), 7);
DisplayUtils.drawRectVerticalW(posX + 76, posY + 1f, 0.5f, 11, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
Object InfoForUser = null;
String name = mc.player.getName().getString();
namewidht = Fonts.sfMedium.getWidth(name, STOPjohnPLEASE);
//рендер верхней части
DisplayUtils.drawRectVerticalW(posX + 14, posY + 1f, 0.5f, 11, ColorUtils.rgba(70, 70, 70, 255), ColorUtils.rgba(70, 70, 70, 255));
Fonts.sfMedium.drawText(ms, "", posX + 22.9f, posY + 3, ColorUtils.rgb(255, 255, 255), 7);
Fonts.icons2.drawText(ms, "", posX + 53f, posY + 3f, ColorUtils.rgb(255, 255, 255), 7);
Fonts.sfMedium.drawText(ms, name, posX + 16f, posY + 3, ColorUtils.rgb(255, 255, 255), 7);
drawStyledRect(65, posY, iconSize + padding * 3.0f + 4 + 6.5f, iconSize + padding * 1.3f, 4);
sdf = new SimpleDateFormat("HH:mm:ss");
timeString = sdf.format(new Date());
String times1 = String.valueOf(timeString);
GradientUtil GradientUtil = null;
ITextComponent timeText = GradientUtil.gradient(timeString);
float timeTextWidth = Fonts.sfui.getWidth(timeText, fontSize);
float timePosX = 65;
float posY1 = 0;
Fonts.sfui.drawText(ms, new StringTextComponent(times1), timePosX * 1.65f + iconSize + padding * 1.5f, posY1 + iconSize / 2 + 0.5f, fontSize, 255);
DisplayUtils.drawRectVerticalW(timePosX * 1.6f + iconSize + padding * 1.5f, posY + iconSize - 23.5f / 2 + 4.5f, 1, 11.0f, 3, ColorUtils.rgba(255, 255, 255, (int) (255 * 0.75f)));
}
private void drawStyledRect(float x, float y, float width, float height, float radius) {
DisplayUtils.drawRoundedRect(x, y, width + 4, height + 1, radius, ColorUtils.rgba(15, 11, 20, 215));
}
}