Upload files to "src/openonyx/render/group_w"

This commit is contained in:
winterflyt committed 2026-11-30 06:12:29 +02:00
1 parent cacabaef4f
commit 8afc7b6d4f
3 files changed
+180

No files matched your search

@@ -0,0 +1,15 @@
package openonyx.render.group_w;
record StatusBarsElementData(float containerU, float containerV, float fillU, float fillV, float scale) {
float l() {
return (8.0F - this.D()) / 2.0F;
}
StatusBarsElementData(float f, float g, float h, float i) {
this(f, g, h, i, 1.0F);
}
float D() {
return 8.0F * this.scale;
}
}
@@ -0,0 +1,48 @@
package openonyx.render.group_w;
import openonyx.render.group_d.Animation;
import openonyx.render.group_d.Easings;
final class StatusBarsElementPart {
private final Animation animation = new Animation(0.0F);
private float f;
private final Animation animation2 = new Animation(0.0F);
private float e = 471.0F;
void L(float f) {
this.e = Math.min(this.e + fx, 471.0F);
this.animation.animateTo(this.f, 200.0F, Easings.EASING2);
this.animation.update(fx);
if (this.f >= this.animation2.getValue()) {
this.animation2.set(Math.max(this.f, this.animation.getValue()));
} else {
this.animation2.animateTo(this.f, 500.0F, Easings.EASING);
this.animation2.update(fx);
}
}
float D() {
return this.animation.getValue();
}
private StatusBarsElementPart() {
}
void L(float f, float g) {
StatusBarsElementPart statusBarsElementPart1 = this;
float h = g <= 0.0F ? 0.0F : Math.clamp(fx / g, 0.0F, 1.0F);
if (h > statusBarsElementPart1.f) {
statusBarsElementPart1.e = 0.0F;
}
statusBarsElementPart1.f = h;
}
float d() {
return this.animation2.getValue();
}
float L() {
return this.e;
}
}
@@ -0,0 +1,117 @@
package openonyx.render.group_w;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiIngame;
import openonyx.features.hud.CustomGui;
import openonyx.render.Render2D;
import openonyx.render.group_d.Easings;
import openonyx.render.group_e.FontFamilyMode;
import openonyx.render.group_e.FontStyle;
import openonyx.render.group_e.TargetHudTextSettingsWeightMode;
import openonyx.theme.Palette;
import openonyx.theme.ThemeManager;
public final class TitleElement extends GuiElement {
private String M = "";
private static final String L = "Title";
private static final FontStyle FONT_STYLE = new FontStyle(FontFamilyMode.PT24, TargetHudTextSettingsWeightMode.SEMI_BOLD, 16.0F, 24.0F);
private static final float m = 120.0F;
private float h;
private String l = "";
private static final float I = 0.88F;
private static final float d = 6.0F;
private static final String i = "Subtitle";
private static final float f = 0.6F;
private float H;
private static final FontStyle FONT_STYLE2 = new FontStyle(FontFamilyMode.PT72, TargetHudTextSettingsWeightMode.BOLD, 36.0F, 44.0F);
@Override
protected boolean L(boolean bl) {
TitleElement titleElement1 = this;
GuiIngame guiIngame;
if ((guiIngame = Minecraft.getMinecraft().ingameGUI) != null && guiIngame.getTitlesTimer() > 0) {
titleElement1.M = guiIngame.getDisplayedTitle() == null ? "" : guiIngame.getDisplayedTitle();
titleElement1.l = guiIngame.getDisplayedSubTitle() == null ? "" : guiIngame.getDisplayedSubTitle();
if (!titleElement1.M.isEmpty() || !titleElement1.l.isEmpty()) {
return titleElement1.L(guiIngame);
}
}
if (bl) {
titleElement1.M = "Title";
titleElement1.l = "Subtitle";
titleElement1.h = 1.0F;
titleElement1.H = 1.0F;
return true;
} else {
titleElement1.h = 0.0F;
return false;
}
}
public TitleElement(CustomGui customGui) {
super("mcgui:title", customGui.customGuiPart2.positionX, customGui.customGuiPart2.positionY, customGui.customGuiPart2.scale);
}
private boolean L(GuiIngame guiIngame) {
float fx = guiIngame.getTitlesTimer();
int j = Math.max(1, guiIngame.getTitleFadeIn());
int ix = Math.max(1, guiIngame.getTitleFadeOut());
float g = 1.0F;
this.H = 1.0F;
TitleElement titleElement1;
if (fx > guiIngame.getTitleFadeOut() + guiIngame.getTitleDisplayTime()) {
g = Math.clamp((j + guiIngame.getTitleDisplayTime() + guiIngame.getTitleFadeOut() - fx) / j, 0.0F, 1.0F);
titleElement1 = this;
this.H = Math.clamp(g / 0.6F, 0.0F, 1.0F);
} else {
if (fx <= guiIngame.getTitleFadeOut()) {
g = Math.clamp(fx / ix, 0.0F, 1.0F);
}
titleElement1 = this;
}
titleElement1.h = (float)Easings.EASING2.apply(g);
return this.h > 0.03F;
}
@Override
protected float d(Render2D render2D) {
return Math.max(120.0F, Math.max(FormattedText.L(render2D, FONT_STYLE2, this.M), FormattedText.L(render2D, FONT_STYLE, this.l)));
}
@Override
protected void L(Render2D render2D, float f, float g, float i) {
Palette palette = ThemeManager.getPalette();
float hx = (float)Easings.EASING7.apply(this.H);
hx = 0.88F + 0.120000005F * hx;
render2D.pushAlpha(this.h);
render2D.pushMatrix();
render2D.scaleAround(hx, fx / 2.0F, g / 2.0F);
g = 0.0F;
if (!this.M.isEmpty()) {
FormattedText.L(render2D, FONT_STYLE2, this.M, fx / 2.0F, render2D.centerTextY(FONT_STYLE2, g + FONT_STYLE2.lineHeight() / 2.0F), palette.onSurface());
g += FONT_STYLE2.lineHeight() + 6.0F;
}
if (!this.l.isEmpty()) {
FormattedText.L(
render2D, FONT_STYLE, this.l, fx / 2.0F, render2D.centerTextY(FONT_STYLE, g + FONT_STYLE.lineHeight() / 2.0F), palette.onSurfaceVariant()
);
}
render2D.popMatrix();
render2D.popAlpha();
}
@Override
protected float L(Render2D render2D) {
float fx = this.M.isEmpty() ? 0.0F : FONT_STYLE2.lineHeight();
if (!this.l.isEmpty()) {
fx += (fx > 0.0F ? 6.0F : 0.0F) + FONT_STYLE.lineHeight();
}
return fx;
}
}