Начинающий
- Статус
- Оффлайн
- Регистрация
- 31 Июл 2024
- Сообщения
- 16
- Реакции
- 0
- Выберите загрузчик игры
- Forge
SS:
Возможно что SS может не соотвествовать коду хз, но держите
Возможно что SS может не соотвествовать коду хз, но держите
HUD:
package wprotect;
import java.awt.Color;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.lwjgl.opengl.GL11;
import wprotect.EventHandler;
import wprotect.AnimatedValue;
import wprotect.ValhallaClient;
import wprotect.ServerManager;
import wprotect.TickEvent;
import wprotect.AnimatedValue;
import wprotect.GuiScreen;
import wprotect.MinecraftClient;
import wprotect.DisplayMode;
import wprotect.ColorUtils;
import wprotect.RenderUtils;
import wprotect.RenderListener;
import wprotect.FontRenderer;
import wprotect.ThemeColor;
import wprotect.MouseUtils;
import wprotect.FontManager;
import wprotect.RenderEvent;
import wprotect.MathUtils;
import wprotect.ResourceLocation;
import wprotect.GuiGraphics;
public class ValhallaHUD implements EventHandler, RenderListener {
public static AnimatedValue pingAnimation;
public boolean renderPing;
public float pingValue;
public static AnimatedValue fpsAnimation;
public boolean renderFps;
public static AnimatedValue tpsAnimation;
public float tpsValue;
public AnimatedValue animationHandler = AnimatedValue.create();
public boolean renderTime;
public boolean renderUsername;
public float fpsWidth;
public float tpsWidth;
public float pingWidth;
public static AnimatedValue usernameAnimation;
public static AnimatedValue timeAnimation;
public static AnimatedValue blurAnimation;
public static AnimatedValue nickAnimation;
public boolean renderBlur;
public float nickWidth;
public void handleMouseClick(RenderEvent event) {
timeAnimation.setValue(mc.currentScreen instanceof GuiScreen ? DisplayMode.ENABLED : DisplayMode.DISABLED);
usernameAnimation.setValue(this.renderTime && mc.currentScreen instanceof GuiScreen ? DisplayMode.ENABLED : DisplayMode.DISABLED);
blurAnimation.setValue(this.renderUsername ? DisplayMode.ENABLED : DisplayMode.DISABLED);
tpsAnimation.setValue(this.renderFps ? DisplayMode.ENABLED : DisplayMode.DISABLED);
fpsAnimation.setValue(this.renderPing ? DisplayMode.ENABLED : DisplayMode.DISABLED);
pingAnimation.setValue(this.renderBlur ? DisplayMode.ENABLED : DisplayMode.DISABLED);
float baseX = 4.0f;
float baseY = 4.0f;
float spacing = 5.0f;
float iconSize = 16.0f;
float textSize = 10.0f;
float fpsAnim = (float)timeAnimation.getValue();
float pingAnim = (float)usernameAnimation.getValue();
float tpsAnim = (float)blurAnimation.getValue();
float nickAnim = (float)tpsAnimation.getValue();
float timeAnim = (float)fpsAnimation.getValue();
String clientName = "Valhalla Recode";
String userName = ValhallaClient.getModuleManager().getSession().getName();
float userNameWidth = FontRenderer.DEFAULT.getStringWidth(userName, 8.0f);
this.fpsWidth = MathUtils.lerp(this.fpsWidth, MinecraftClient.getInstance().getFps(), 10.0f);
String fpsText = Math.round(this.fpsWidth) + "fps";
float fpsTextWidth = FontRenderer.DEFAULT.getStringWidth(fpsText, 8.0f);
this.tpsWidth = MathUtils.lerp(this.tpsWidth, ValhallaClient.getModuleManager().getTpsManager().getTps(), 10.0f);
String tpsText = MathUtils.roundToStep(this.tpsWidth, 0.1) + "tps";
float tpsTextWidth = FontRenderer.DEFAULT.getStringWidth(tpsText, 8.0f);
this.pingWidth = MathUtils.lerp(this.pingWidth, ServerManager.getPing(), 10.0f);
String pingText = Math.round(this.pingWidth) + "ms";
float pingTextWidth = FontRenderer.DEFAULT.getStringWidth(pingText, 8.0f);
String originalFpsText = fpsText;
float remainingWidth = FontRenderer.DEFAULT.getStringWidth(originalFpsText, 8.0f) - 22.0f;
float totalHeight = textSize + spacing + remainingWidth + userNameWidth;
float totalWidth = 5.0f + textSize + spacing + FontRenderer.DEFAULT.getStringWidth(clientName, 8.0f) + 5.0f +
(0.6f + 5.0f + 9.0f + userNameWidth + 5.0f + 0.6f) * tpsAnim +
(9.0f + fpsTextWidth + 10.0f) * nickAnim +
(9.0f + pingTextWidth + 10.0f) * timeAnim;
double mouseX = event.getMouseX();
double mouseY = event.getMouseY();
if (MouseUtils.isHovered(baseX - 4.0f + totalWidth - 8.0f,
baseY + (totalHeight + 2.0f) / 2.0f - 8.0f,
18.0f, 17.0f, mouseX, mouseY)) {
this.renderTime = !this.renderTime;
}
if (timeAnimation.getValue() != 0.0) {
if (MouseUtils.isHovered(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
baseY + 7.5f - 2.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f, mouseX, mouseY)) {
this.animationHandler.animation1 = this.renderUsername = !this.renderUsername;
this.animationHandler.reset();
}
if (MouseUtils.isHovered(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
baseY + 19.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f, mouseX, mouseY)) {
this.animationHandler.animation2 = this.renderFps = !this.renderFps;
this.animationHandler.reset();
}
if (MouseUtils.isHovered(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
(baseY += 14.5f) + 19.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f, mouseX, mouseY)) {
this.animationHandler.animation3 = this.renderPing = !this.renderPing;
this.animationHandler.reset();
}
if (MouseUtils.isHovered(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
(baseY += 14.5f) + 19.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f, mouseX, mouseY)) {
this.animationHandler.animation4 = this.renderBlur = !this.renderBlur;
this.animationHandler.reset();
}
}
}
public void onRenderTick(TickEvent.RenderTick event) {
GuiGraphics graphics = event.getGraphics();
timeAnimation.setValue(mc.currentScreen instanceof GuiScreen ? DisplayMode.ENABLED : DisplayMode.DISABLED);
usernameAnimation.setValue(this.renderTime && mc.currentScreen instanceof GuiScreen ? DisplayMode.ENABLED : DisplayMode.DISABLED);
blurAnimation.setValue(this.renderUsername ? DisplayMode.ENABLED : DisplayMode.DISABLED);
tpsAnimation.setValue(this.renderFps ? DisplayMode.ENABLED : DisplayMode.DISABLED);
fpsAnimation.setValue(this.renderPing ? DisplayMode.ENABLED : DisplayMode.DISABLED);
pingAnimation.setValue(this.renderBlur ? DisplayMode.ENABLED : DisplayMode.DISABLED);
float baseX = 4.0f;
float baseY = 4.0f;
float spacing = 5.0f;
float iconSize = 16.0f;
float textSize = 10.0f;
float fpsAnim = (float)timeAnimation.getValue();
float pingAnim = (float)usernameAnimation.getValue();
float tpsAnim = (float)blurAnimation.getValue();
float nickAnim = (float)tpsAnimation.getValue();
float timeAnim = (float)fpsAnimation.getValue();
String clientName = "Valhalla Recode";
StringBuilder coloredName = new StringBuilder();
for (int i = 0; i < clientName.length(); i++) {
int color = ColorUtils.interpolateColor(Color.white.getRGB(), ThemeColor.background, i);
coloredName.append(ColorUtils.getColorCode(color)).append(clientName.charAt(i));
}
String userName = ValhallaClient.getModuleManager().getSession().getName();
float userNameWidth = FontRenderer.DEFAULT.getStringWidth(userName, 8.0f);
this.fpsWidth = MathUtils.lerp(this.fpsWidth, MinecraftClient.getInstance().getFps(), 10.0f);
String fpsText = Math.round(this.fpsWidth) + "fps";
float fpsTextWidth = FontRenderer.DEFAULT.getStringWidth(fpsText, 8.0f);
this.tpsWidth = MathUtils.lerp(this.tpsWidth, ValhallaClient.getModuleManager().getTpsManager().getTps(), 10.0f);
String tpsText = MathUtils.roundToStep(this.tpsWidth, 0.1) + "tps";
float tpsTextWidth = FontRenderer.DEFAULT.getStringWidth(tpsText, 8.0f);
this.pingWidth = MathUtils.lerp(this.pingWidth, ServerManager.getPing(), 10.0f);
String pingText = Math.round(this.pingWidth) + "ms";
float pingTextWidth = FontRenderer.DEFAULT.getStringWidth(pingText, 8.0f);
String originalFpsText = fpsText;
float remainingWidth = FontRenderer.DEFAULT.getStringWidth(originalFpsText, 8.0f) - 22.0f;
float combinedWidth = textSize + spacing + remainingWidth + userNameWidth;
float clientNameWidth = FontRenderer.DEFAULT.getStringWidth(clientName, 8.0f);
float totalWidth = 5.0f + textSize + spacing + clientNameWidth + 5.0f +
(0.6f + 5.0f + 9.0f + userNameWidth + 5.0f + 0.6f) * tpsAnim +
(9.0f + fpsTextWidth + 10.0f) * nickAnim +
(9.0f + pingTextWidth + 10.0f) * timeAnim;
RenderUtils.drawRectWithGlow(baseX, baseY, totalWidth - 4.0f + 10.0f * fpsAnim, combinedWidth + 2.0f, 12.0f, 1.0f, this.renderUsername);
GL11.glPushMatrix();
GL11.glTranslated(baseX - 4.0f + totalWidth - 8.0f - 4.0f * (1.0f - fpsAnim) + 9.0f,
baseY + (combinedWidth + 2.0f) / 2.0f - 8.0f + 8.0f, 0.0);
GL11.glScaled(0.5f * fpsAnim, 0.5f * fpsAnim, 1.0);
GL11.glRotatef((float)(0.0 + 360.0 * usernameAnimation.getValue() - 360.0f * (1.0f - fpsAnim)), 0.0f, 0.0f, 1.0f);
GL11.glTranslated(-(baseX - 4.0f + totalWidth - 8.0f - 4.0f * (1.0f - fpsAnim) + 9.0f),
-(baseY + (combinedWidth + 2.0f) / 2.0f - 8.0f + 8.0f), 1.0);
RenderUtils.drawTexture(new ResourceLocation("valhalla/icons/Vector.png"),
baseX - 4.0f + totalWidth - 8.0f - 4.0f * (1.0f - fpsAnim),
baseY + (combinedWidth + 2.0f) / 2.0f - 8.0f,
18.0f, 17.0f, ColorUtils.rgb(255, 255, 255, (int)(255.0f * fpsAnim)));
GL11.glPopMatrix();
baseX = 4.0f;
FontManager.ICONS[iconSize].drawString(graphics, "G", baseX + 5.0f, baseY + 7.7f,
ColorUtils.darker(ThemeColor.background, 200));
float nameX = baseX + 13.0f + spacing * 1.5f - 6.0f;
FontRenderer.DEFAULT.drawString(graphics, coloredName.toString(), nameX, baseY + 5.0f,
ThemeColor.background, 8.0f, 0.8f);
nameX += FontRenderer.DEFAULT.getStringWidth(clientName, 8.0f);
if (tpsAnim != 0.0f || nickAnim != 0.0f || timeAnim != 0.0f) {
RenderUtils.drawLine(nameX += 5.0f, baseY + 5.0f, 0.6f, 8.0f, -1, Math.min(0.3f * nickAnim + tpsAnim + timeAnim, 0.3f));
nameX += 5.0f;
}
if (tpsAnim != 0.0f) {
FontManager.ICONS[iconSize].drawString(graphics, "J", nameX - 1.3, baseY + 7.3f,
ColorUtils.interpolateColor(ThemeColor.background, tpsAnim));
FontRenderer.DEFAULT.drawString(graphics, userName,
nameX += 9.0f * tpsAnim, baseY + 5.0f,
-1, 8.0f, tpsAnim,
FontRenderer.DEFAULT.getStringWidth(userName, 8.0f) * tpsAnim);
nameX += (FontRenderer.DEFAULT.getStringWidth(userName, 8.0f) + 5.0f) * tpsAnim;
}
if (nickAnim != 0.0f && tpsAnim != 0.0f) {
RenderUtils.drawLine(nameX, baseY + 5.0f, 0.6f, 8.0f, -1, 0.3f * tpsAnim * nickAnim);
nameX += 5.0f * tpsAnim * nickAnim;
}
if (nickAnim != 0.0f) {
FontManager.ICONS[iconSize].drawString(graphics, "H", nameX - 1.0f, baseY + 7.6f,
ColorUtils.interpolateColor(ThemeColor.background, nickAnim));
FontRenderer.DEFAULT.drawString(graphics, originalFpsText,
nameX += 9.0f * nickAnim, baseY + 5.0f,
ColorUtils.rgb(255, 255, 255), 8.0f, nickAnim,
FontRenderer.DEFAULT.getStringWidth(originalFpsText, 8.0f) * nickAnim);
nameX += (FontRenderer.DEFAULT.getStringWidth(originalFpsText, 8.0f) + 5.0f) * nickAnim;
}
pingAnimation.setValue(nickAnim != 0.0f || tpsAnim != 0.0f ? DisplayMode.ENABLED : DisplayMode.DISABLED);
nameX = (float)(nameX - 5.0f * pingAnimation.getValue());
if (timeAnim != 0.0f && pingAnimation.getValue() != 0.0) {
nameX = (float)(nameX + 5.0f * pingAnimation.getValue());
RenderUtils.drawLine(nameX, baseY + 5.0f, 0.6f, 8.0f, -1, (float)(0.3f * timeAnim * pingAnimation.getValue()));
nameX = (float)(nameX + 5.0f * pingAnimation.getValue());
}
if (timeAnim != 0.0f) {
FontManager.ICONS[iconSize + 4].drawString(graphics, "I", nameX - 2.0f, baseY + 6.5f,
ColorUtils.interpolateColor(ThemeColor.background, timeAnim));
FontRenderer.DEFAULT.drawString(graphics, pingText,
(nameX += 11.0f * timeAnim) - 1.0f, baseY + 5.0f,
ColorUtils.rgb(255, 255, 255, 255), 8.0f, timeAnim,
FontRenderer.DEFAULT.getStringWidth(pingText, 8.0f) * timeAnim);
}
this.nickWidth = MathUtils.lerp(this.nickWidth, 158.0f + fpsTextWidth * nickAnim + tpsTextWidth + pingTextWidth - 89.0f, 10.0f);
baseX -= 4.0f;
if (usernameAnimation.getValue() != 0.0) {
RenderUtils.drawRectWithBlur(baseX + totalWidth + 10.0f, baseY, 86.0f, 60.0f, 15.0f, 1.0f, pingAnim * fpsAnim, this.renderUsername);
FontRenderer.DEFAULT.drawString(event.getGraphics(), "Блюр",
baseX + totalWidth + 10.0f + 4.0f, baseY + 7.5f - 2.5f,
-1, 7.0f, 0.5f * pingAnim * fpsAnim);
RenderUtils.drawLine(baseX + totalWidth + 10.0f + 4.0f, baseY + 15.0f, 76.0f, 0.5f, -1, 0.1f * pingAnim * fpsAnim);
FontRenderer.DEFAULT.drawString(event.getGraphics(), "Никнейм",
baseX + totalWidth + 10.0f + 4.0f, baseY + 19.5f,
-1, 7.0f, 0.5f * pingAnim * fpsAnim);
RenderUtils.drawRectWithGlow(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
baseY + 7.5f - 2.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f,
8.0f, Color.black, Color.black, false,
0.3f * pingAnim * fpsAnim, 1.0f, 30.0f);
RenderUtils.drawRectWithGlow(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
baseY + 19.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f,
8.0f, Color.black, Color.black, false,
0.3f * pingAnim * fpsAnim, 1.0f, 30.0f);
RenderUtils.drawCircle(baseX + totalWidth + 10.0f + 106.0f - 41.0f + 8.0f * blurAnimation.getValue(),
baseY + 7.5f - 2.5f - 1.0f + (FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f) / 2.0f - 3.0f,
6.0f, 370.0f, Color.white,
ColorUtils.interpolateColor(ThemeColor.secondary, Color.white.getRGB(), (float)blurAnimation.getValue()),
0.3f * pingAnim * fpsAnim, 20.0f);
RenderUtils.drawCircle(baseX + totalWidth + 10.0f + 106.0f - 41.0f + 8.0f * tpsAnim,
baseY + 19.5f - 1.0f + (FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f) / 2.0f - 3.0f,
6.0f, 370.0f, Color.white,
ColorUtils.interpolateColor(ThemeColor.secondary, Color.white.getRGB(), tpsAnim),
0.3f * pingAnim * fpsAnim, 20.0f);
FontRenderer.DEFAULT.drawString(event.getGraphics(), "Фпс",
baseX + totalWidth + 10.0f + 4.0f,
(baseY += 14.5f) + 19.5f, -1, 7.0f, 0.5f * pingAnim * fpsAnim);
RenderUtils.drawLine(baseX + totalWidth + 10.0f + 4.0f, baseY + 15.0f, 76.0f, 0.5f, -1, 0.1f * pingAnim * fpsAnim);
RenderUtils.drawRectWithGlow(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
baseY + 19.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f,
8.0f, Color.black, Color.black, false,
0.3f * pingAnim * fpsAnim, 1.0f, 30.0f);
RenderUtils.drawCircle(baseX + totalWidth + 10.0f + 106.0f - 41.0f + 8.0f * fpsAnimation.getValue(),
baseY + 19.5f - 1.0f + (FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f) / 2.0f - 3.0f,
6.0f, 370.0f, Color.white,
ColorUtils.interpolateColor(ThemeColor.secondary, Color.white.getRGB(), (float)fpsAnimation.getValue()),
0.3f * pingAnim * fpsAnim, 20.0f);
FontRenderer.DEFAULT.drawString(event.getGraphics(), "Пинг",
baseX + totalWidth + 10.0f + 4.0f,
(baseY += 14.5f) + 19.5f, -1, 7.0f, 0.5f * pingAnim * fpsAnim);
RenderUtils.drawLine(baseX + totalWidth + 10.0f + 4.0f, baseY + 15.0f, 76.0f, 0.5f, -1, 0.1f * pingAnim * fpsAnim);
RenderUtils.drawRectWithGlow(baseX + totalWidth + 10.0f + 106.0f - 43.0f,
baseY + 19.5f - 1.0f,
18.0f, FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f,
8.0f, Color.black, Color.black, false,
0.3f * pingAnim * fpsAnim, 1.0f, 30.0f);
RenderUtils.drawCircle(baseX + totalWidth + 10.0f + 106.0f - 41.0f + 8.0f * pingAnimation.getValue(),
baseY + 19.5f - 1.0f + (FontRenderer.DEFAULT.getLineHeight(7.0f) + 2.0f) / 2.0f - 3.0f,
6.0f, 370.0f, Color.white,
ColorUtils.interpolateColor(ThemeColor.secondary, Color.white.getRGB(), (float)pingAnimation.getValue()),
0.3f * pingAnim * fpsAnim, 20.0f);
}
}
static {
usernameAnimation = new AnimatedValue(700, 1.0, DisplayMode.ENABLED);
blurAnimation = new AnimatedValue(400, 1.0, DisplayMode.ENABLED);
pingAnimation = new AnimatedValue(400, 1.0, DisplayMode.ENABLED);
timeAnimation = new AnimatedValue(700, 1.0, DisplayMode.DISABLED);
tpsAnimation = new AnimatedValue(400, 1.0, DisplayMode.DISABLED);
fpsAnimation = new AnimatedValue(400, 1.0, DisplayMode.DISABLED);
nickAnimation = new AnimatedValue(400, 1.0, DisplayMode.DISABLED);
}
public ValhallaHUD() {
this.renderUsername = this.animationHandler.animation1;
this.renderFps = this.animationHandler.animation2;
this.renderPing = this.animationHandler.animation3;
this.renderBlur = this.animationHandler.animation4;
}
public StringBuilder getTime() {
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");
String time = timeFormat.format(new Date());
StringBuilder builder = new StringBuilder();
builder.append(time);
return builder;
}
}