package im.smesharik.ui.display.impl;
import com.mojang.blaze3d.matrix.MatrixStack;
import im.smesharik.smesharik;
import im.smesharik.events.EventDisplay;
import im.smesharik.ui.display.ElementRenderer;
import im.smesharik.ui.styles.Style;
import im.smesharik.utils.client.PingUtil;
import im.smesharik.utils.render.ColorUtils;
import im.smesharik.utils.render.DisplayUtils;
import im.smesharik.utils.render.font.Fonts;
import im.smesharik.utils.text.GradientUtil;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.Color;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.client.multiplayer.ServerData;
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class WatermarkRenderer implements ElementRenderer {
final Minecraft mc = Minecraft.getInstance();
@Override
public void render(EventDisplay eventDisplay) {
MatrixStack ms = eventDisplay.getMatrixStack();
float posX = 3;
float posY = 3;
float padding = 3;
float fontSize = 6.5f;
float iconSize = 8;
float localHeight = fontSize + padding * 2;
final ResourceLocation logo = new ResourceLocation("smesharik/images/hud/gradline.png");
Style style = smesharik.getInstance().getStyleManager().getCurrentStyle();
int fps = mc.getDebugFPS();
float textWidth = Fonts.sfui.getWidth("smesharik.cc - " + mc.session.getUsername() + " - " + PingUtil.serverIP(), fontSize);
DisplayUtils.drawShadow(posX, posY, textWidth+padding, localHeight + 2, 15, ColorUtils.rgba(0,0,0,100));
drawStyledRect(posX, posY, textWidth+padding, localHeight + 2, 3);
Fonts.sfMedium.drawText(ms, "smesharik.cc - " + mc.session.getUsername() + " - " + PingUtil.serverIP(), posX+padding, posY + padding + 1, ColorUtils.rgb(255,255,255), fontSize);
DisplayUtils.drawImage(logo, posX, posY + 1, textWidth+padding, 1, ColorUtils.rgb(97,107,189));
}
private void drawStyledRect(float x,
float y,
float width,
float height,
float radius) {
DisplayUtils.drawRoundedRect(x, y, width, height, radius, ColorUtils.rgba(0, 0, 0, 255));
}
}