@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class WatermarkRenderer implements ElementRenderer {
final Minecraft mc = Minecraft.getInstance();
final ResourceLocation logo = new ResourceLocation("cosmohack/images/hud/rhomb1.png");
final ResourceLocation fpsIcon = new ResourceLocation("cosmohack/images/hud/fps1.png");
final ResourceLocation timeIcon = new ResourceLocation("cosmohack/images/hud/time1.png");
final ResourceLocation compass = new ResourceLocation("cosmohack/images/compass.png");
final ResourceLocation gps = new ResourceLocation("cosmohack/images/hud/gps1.png");
@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 = AlphaClass.getInstance().getStyleManager().getCurrentStyle();
String fps1 = String.valueOf(mc.debugFPS);
drawStyledRect(posX , posY , iconSize + padding * 9 , iconSize + padding * 1.3f , 4);
// DisplayUtils.drawImage(logo, posX + padding, posY - 2.0f + padding, iconSize, iconSize , ColorUtils.rgb(255, 255, 255));
DisplayUtils.drawRectVerticalW(posX + 17.5f , posY + 3.5f , 0.5f , 7 , ColorUtils.rgba(70 , 70 , 70 , 255) , ColorUtils.rgba(70 , 70 , 70 , 255));
Fonts.msMedium.drawText(ms , "Release" , posX + 19.5f , posY + 3f , HUD.getColor(0) , fontSize + 1);
Fonts.icon.drawText(ms , "B" , posX + 4.0f , posY + 1.0f , HUD.getColor(0) , fontSize + 4);
int fps = mc.getDebugFPS();
ITextComponent fpsText = GradientUtil.gradient(String.valueOf(fps));
float fpsTextWidth = Fonts.msMedium.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(PingUtil.calculateBPS());
String name = mc.player.getName().getString();
float namewidht = Fonts.msMedium.getWidth(name , fontSize);
float fpsTextWidth1 = Fonts.msMedium.getWidth(bps , fontSize);
float fpsWidth = Fonts.msMedium.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.msMedium.drawText(eventDisplay.getMatrixStack() , bps , posX + 18 , posY + 18.8f , ColorUtils.rgb(210 , 210 , 210) , fontSize , 0.05f);
Fonts.icon.drawText(eventDisplay.getMatrixStack() , "F" , 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.msMedium.drawText(eventDisplay.getMatrixStack() , tps + " Ticks" , posX + 40 + fpsTextWidth1 , posY + 18.8f , ColorUtils.rgb(210 , 210 , 210) , fontSize , 0.05f);
Fonts.icon.drawText(eventDisplay.getMatrixStack() , tps + "Q" , posX + 27 + fpsTextWidth1 , posY + 18.1f , HUD.getColor(0) , fontSize + 1 , 0.05f);
drawStyledRect(posX + 78 + fpsTextWidth1 , posY + 15 , iconSize + padding * 9.2f , 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.msMedium.drawText(eventDisplay.getMatrixStack() , bpsget + " BPS" , posX + 97 + fpsTextWidth1 , posY + 18.8f , ColorUtils.rgb(210 , 210 , 210) , fontSize , 0.05f);
Fonts.icon.drawText(eventDisplay.getMatrixStack() , tps + "S" , 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);
float wthidewidth = Fonts.sfui.getWidth("cosmohack" , fontSize);
if (!HUD.wtname.get()) {
drawStyledRect(posX + 52.1f , posY + 0 , iconSize + padding + 50 + namewidht + fpsWidth + timeTextWidth , iconSize + padding * 1.3f , 4);
}
// DisplayUtils.drawRectVerticalW(posX + 66.9f + +namewidht , posY + 3.0f , 0.5f , 7 , ColorUtils.rgba(70 , 70 , 70 , 255) , ColorUtils.rgba(70 , 70 , 70 , 255));
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));
// drawStyledRect(posX + 52.1f , posY + 0 , iconSize + padding + 5 + namewidht , iconSize + padding * 1.3f , 4);
else if (!HUD.wtname.get()){
Fonts.msMedium.drawText(eventDisplay.getMatrixStack() , name , posX + 64 , posY + 3.5f , ColorUtils.rgb(210 , 210 , 210) , fontSize , 0.05f);
}
Fonts.icon.drawText(eventDisplay.getMatrixStack() , tps + "W" , posX + 55 , posY + 3.1f , HUD.getColor(0) , fontSize + 1 , 0.05f);
Fonts.msMedium.drawText(eventDisplay.getMatrixStack() , fps + " Fps" , posX + 80 + namewidht , posY + 3.5f , ColorUtils.rgba(210 , 210 , 210 , 255) , fontSize + 0 , 0.05f);
Fonts.icon.drawText(eventDisplay.getMatrixStack() , tps + "X" , posX + 70 + namewidht , posY + 3.1f , HUD.getColor(0) , fontSize + 1 , 0.05f);
Fonts.icon.drawText(eventDisplay.getMatrixStack() , tps + "V" , posX + 101 + namewidht + fpsWidth , posY + 3.1f , HUD.getColor(0) , fontSize + 1 , 0.05f);
Fonts.msMedium.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) {
KawaseBlur.blur.updateBlur(2 , 2);
KawaseBlur.blur.render(() -> {
DisplayUtils.drawRoundedRect(x , y , width + -4 , height + -3 , radius , ColorUtils.rgba(0 , 0 , 0 , 255));
});
DisplayUtils.drawRoundedRect(x , y , width + -4 , height + -3 , radius , ColorUtils.rgba(0 , 0 , 0 , 195));
}