package im.expensive.ui.display.impl;
import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.events.EventDisplay;
import im.expensive.ui.display.ElementRenderer;
import im.expensive.ui.styles.Style;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.KawaseBlur;
import im.expensive.utils.render.font.Fonts;
import im.expensive.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.ITextComponent;
import java.text.SimpleDateFormat;
import java.util.Date;
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class WatermarkRenderer implements ElementRenderer {
final Minecraft mc = Minecraft.getInstance();
final ResourceLocation logo = new ResourceLocation("expensive/images/hud/logo.png");
@Override
public void render(EventDisplay eventDisplay) {
MatrixStack ms = eventDisplay.getMatrixStack();
float posX = 5;
float posY = 4;
float padding = 5;
float fontSize = 7.5f;
float iconSize = 10;
float posX1 = 65;
float posY1 = 4;
final ITextComponent text = GradientUtil.gradient("Corbanara Client | Build 1.5");
Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();
//блюр начался (перед ним можешь запихнуть какой то рект или тень,чтоб он не был пустым
KawaseBlur.blur.updateBlur(1, 5); // STEPS - интенсивность блюра!
KawaseBlur.blur.render(() -> {
drawStyledRect(posX, posY, iconSize + padding * 25.0f, iconSize + padding * 2.5f, 4);
});
DisplayUtils.drawImage(logo, posX + padding, posY + padding, iconSize, iconSize, ColorUtils.rgb(255, 255, 255));
DisplayUtils.drawRectVerticalW(posX + 18.0f, posY + 7.5f, 1, 14.0f, 3, ColorUtils.rgba(255, 255, 255, (int) (255 * 0.75f)));
Fonts.sfbold.drawCenteredText(ms, text, posX + 75.0f, posY + 7.1f, fontSize);
}
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, 255));
}
}