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

This commit is contained in:
winterflyt committed 2026-11-30 06:12:01 +02:00
1 parent 2f68dddd12
commit d8ebaf1a02
5 files changed
+689

No files matched your search

@@ -0,0 +1,111 @@
package openonyx.render.group_w;
import net.minecraft.entity.boss.BossStatus;
import openonyx.features.hud.CustomGui;
import openonyx.render.Render2D;
import openonyx.render.group_d.Animation;
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 BossBarElement extends GuiElement {
private final Animation animation = new Animation(0.0F);
private static final float M = 0.5F;
private String L;
private float j;
private final CustomGui customGui;
private static final float h = 182.0F;
private static final float l = 3.0F;
private final Animation animation2 = new Animation(0.0F);
private static final float d = 2.0F;
private static final float i = 0.7F;
private static final FontStyle FONT_STYLE = new FontStyle(FontFamilyMode.PT24, TargetHudTextSettingsWeightMode.BOLD, 12.0F, 15.0F);
private static final float H = 10.0F;
private static final float e = 6.0F;
@Override
protected float d(Render2D render2D) {
return 182.0F;
}
@Override
protected boolean L(boolean bl) {
if (BossStatus.bossName != null && BossStatus.statusBarTime > 0) {
BossStatus.statusBarTime--;
this.L = BossStatus.bossName;
this.j = Math.clamp(BossStatus.healthScale, 0.0F, 1.0F);
return true;
} else if (bl) {
this.L = "Boss";
this.j = 0.7F;
return true;
} else {
return false;
}
}
@Override
protected float L(Render2D render2D) {
return FONT_STYLE.lineHeight() + 3.0F + 6.0F;
}
public BossBarElement(CustomGui customGui) {
super("mcgui:bossbar", customGuix.customGuiPart6.positionX, customGuix.customGuiPart6.positionY, customGuix.customGuiPart6.scale);
this.L = "";
this.customGui = customGuix;
}
@Override
protected void L(float f) {
this.animation.animateTo(this.j, 200.0F, Easings.EASING2);
this.animation.update(f);
if (this.j >= this.animation2.getTarget()) {
this.animation2.set(Math.max(this.j, this.animation.getValue()));
} else {
this.animation2.animateTo(this.j, 500.0F, Easings.EASING);
this.animation2.update(f);
}
}
@Override
protected void L(Render2D render2D, float f, float g, float i) {
Palette palette = ThemeManager.getPalette();
FormattedText.L(render2D, FONT_STYLE, this.L, f / 2.0F, render2D.centerTextY(FONT_STYLE, FONT_STYLE.lineHeight() / 2.0F), palette.onSurface());
g -= 6.0F;
render2D.roundedRect(0.0F, g, f, 6.0F, Float.MAX_VALUE, palette.surfaceContainerHighest());
if (this.customGui.customGuiPart6.segments.isEnabled()) {
this.L(render2D, palette, f, g);
} else {
float hx;
if ((hx = f * this.animation2.getValue()) > 0.5F) {
render2D.roundedRect(0.0F, g, hx, 6.0F, Float.MAX_VALUE, ThemeManager.withAlpha(palette.error(), 0.45F));
}
if ((f = f * this.animation.getValue()) > 0.5F) {
render2D.roundedRect(0.0F, g, f, 6.0F, Float.MAX_VALUE, palette.error());
}
}
}
private void L(Render2D render2D, Palette palette, float f, float g) {
float hx;
float ix = (hx = (f + 2.0F) / 10.0F) - 2.0F;
f *= this.animation.getValue();
int jx;
for (int lx = jx = 0; lx < 10.0F; lx = jx) {
float k;
if ((k = jx * hx) >= f) {
return;
}
render2D.pushScissor(k, g, Math.min(ix, f - k), 6.0F);
jx++;
render2D.roundedRect(k, g, ix, 6.0F, Float.MAX_VALUE, palette.error());
render2D.popScissor();
}
}
}
@@ -0,0 +1,116 @@
package openonyx.render.group_w;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiChat;
import openonyx.core.OnyxClient;
import openonyx.features.hud.CustomGui;
import openonyx.features.render.NoRender;
import openonyx.render.Render2D;
public final class CustomGuiRenderer {
private static StatusBarsElement statusBarsElement;
private static float d = Float.NaN;
private static HotbarElement hotbarElement;
private static BossBarElement bossBarElement;
private static TitleElement titleElement;
private static ScoreboardElement scoreboardElement;
public static float L() {
return d;
}
private static CustomGui L() {
CustomGui customGui;
if ((customGui = CustomGuiState.L()) == null) {
return null;
}
if (scoreboardElement == null) {
scoreboardElement = new ScoreboardElement(customGui);
titleElement = new TitleElement(customGui);
bossBarElement = new BossBarElement(customGui);
hotbarElement = new HotbarElement(customGui);
statusBarsElement = new StatusBarsElement(customGui);
}
return customGui;
}
public static boolean L() {
CustomGui customGui = L();
Minecraft minecraft = Minecraft.getMinecraft();
return customGui != null && customGui.isEnabled() && minecraft.thePlayer != null && minecraft.theWorld != null;
}
private CustomGuiRenderer() {
}
public static void L(Render2D render2D, float f, float g) {
Render2D render2D1 = render2D;
CustomGui customGui;
if ((customGui = L()) != null) {
Minecraft minecraft;
if ((minecraft = Minecraft.getMinecraft()).thePlayer != null && minecraft.theWorld != null) {
float h = CustomGuiState.D();
boolean bl = minecraft.currentScreen instanceof GuiChat;
NoRender noRender = OnyxClient.moduleManager.noRender;
CustomGui customGui1;
if (customGui.customGuiPart6.isEnabled() && !noRender.L(noRender.bossBar)) {
bossBarElement.L(render2D1, f, g, bl);
customGui1 = customGui;
} else {
bossBarElement.L();
customGui1 = customGui;
}
if (customGui1.customGuiPart8.isEnabled() && !noRender.L(noRender.scoreboard)) {
scoreboardElement.L(render2D1, f, g, bl);
customGui1 = customGui;
} else {
scoreboardElement.L();
customGui1 = customGui;
}
float l;
if (customGui1.customGuiPart2.isEnabled()) {
titleElement.L(render2D1, f, g, bl);
l = g;
} else {
titleElement.L();
l = g;
}
float j = l;
float i = f / 2.0F - 103.0F;
float k = f / 2.0F + 103.0F;
if (hotbarElement.L()) {
hotbarElement.L(render2D1, f, g, h);
j = hotbarElement.d();
i = hotbarElement.D();
k = hotbarElement.L();
}
f = j;
if (statusBarsElement.L()) {
statusBarsElement.L(render2D1, i, k, j, h);
if (Float.isFinite(statusBarsElement.L())) {
f = Math.min(f, statusBarsElement.L());
}
}
d = f;
}
}
}
public static void L() {
if (scoreboardElement != null) {
scoreboardElement.L();
titleElement.L();
bossBarElement.L();
hotbarElement.L();
statusBarsElement.L();
d = Float.NaN;
}
}
}
@@ -0,0 +1,94 @@
package openonyx.render.group_w;
import java.util.function.Predicate;
import openonyx.core.OnyxClient;
import openonyx.features.hud.CustomGui;
public final class CustomGuiState {
private static boolean I;
private static long d;
private static final float i = 100.0F;
private static final float f = 16.0F;
public static final int H = 22;
private static float e = 16.0F;
public static boolean e() {
return L(customGui -> customGui.customGuiPart9.isEnabled());
}
public static boolean k() {
return L(customGui -> customGui.customGuiPart.isEnabled());
}
public static float D() {
return e;
}
public static float d() {
long l = System.nanoTime();
e = d == 0L ? 16.0F : Math.min((float)(l - d) / 1000000.0F, 100.0F);
d = l;
return e;
}
public static boolean F() {
return L(customGui -> customGui.customGuiPart9.isEnabled() && customGui.customGuiPart9.smoothCaret.isEnabled());
}
public static boolean l() {
return I;
}
public static void d() {
I = true;
}
public static float L() {
CustomGui customGui;
return (customGui = L()) != null && customGui.isEnabled() && customGui.customGuiPart3.isEnabled()
? customGui.customGuiPart3.keepDim.getFloat() / 100.0F
: 1.0F;
}
public static void L() {
I = false;
}
public static boolean h() {
return L(customGui -> customGui.customGuiPart7.centeredContainers.isEnabled());
}
public static boolean I() {
return L(customGui -> customGui.customGuiPart6.isEnabled());
}
private static boolean L(Predicate<CustomGui> predicate) {
Predicate predicate1 = predicate;
CustomGui customGui;
return (customGui = L()) != null && customGui.isEnabled() && predicate1.test(customGui);
}
private CustomGuiState() {
}
public static boolean i() {
return L(customGui -> customGui.customGuiPart4.isEnabled());
}
public static boolean D() {
return L(customGui -> customGui.customGuiPart2.isEnabled());
}
public static boolean d() {
return L(customGui -> customGui.customGuiPart8.isEnabled());
}
public static boolean L() {
CustomGui customGui;
return (customGui = L()) != null && customGui.isEnabled();
}
public static CustomGui L() {
return OnyxClient.moduleManager == null ? null : OnyxClient.moduleManager.customGui;
}
}
@@ -0,0 +1,346 @@
package openonyx.render.group_w;
import java.util.Random;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import openonyx.core.OnyxClient;
import openonyx.features.hud.CustomGui;
import openonyx.render.group_e.FontFamily;
import openonyx.render.group_e.FontFamilyMode;
import openonyx.render.group_e.FontStyle;
import openonyx.render.group_e.GlyphFont;
import openonyx.render.group_e.GlyphFontData;
import openonyx.render.group_e.TargetHudTextSettingsWeightMode;
import org.lwjgl.opengl.GL11;
public final class FontRendererHook {
private static final Random RANDOM = new Random();
private static final float M = 1.0F;
private static TargetHudTextSettingsWeightMode targetHudTextSettingsWeightMode;
private static final int j = 16579836;
private static float m;
private static FontStyle fontStyle;
private static final float l = 0.2F;
private static FontStyle fontStyle2;
private static final float d = 7.0F;
private static final float i = 7.0F;
private static boolean f;
private static final String H = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
private static boolean e;
private static float L(FontRenderer fontRenderer, char c, float f, float g, int i, boolean bl) {
String string = String.valueOf(c);
e = true;
try {
fontRenderer.drawString(string, fx, g, ix, false);
return fontRenderer.getCharWidth(c) + (bl ? fontRenderer.offsetBold : 0.0F);
} finally {
e = false;
GlStateManager.enableTexture2D();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
}
}
public static boolean L(char c) {
char dx = c;
try {
return dx == 167 || dx == ' ' || L(false).L().d(dx);
} catch (Throwable throwable) {
f = true;
OnyxClient.LOGGER.warn("Custom GUI font stood down to the bitmap font after a failure", throwable);
return false;
}
}
public static float L(char c) {
char dx = c;
FontStyle fontStylex;
return dx == 167 ? -1.0F : (fontStylex = L(false)).L().D(dx) * fontStylex.L() + L();
}
private static void L(FontRenderer fontRenderer, String string, float f, float g, int i, boolean bl) {
FontRenderer fontRenderer1 = fontRenderer;
if (!string.isEmpty()) {
FontStyle fontStylex;
GlyphFont glyphFont = (fontStylex = L(false)).L();
GlyphFont glyphFont1 = L(true).L();
int jx;
for (int p = jx = 0; p < string.length(); p = jx) {
glyphFont.d(string.charAt(jx));
glyphFont1.d(string.charAt(jx++));
}
if (glyphFont.L() != -1) {
float mx = fontStylex.L();
ix = ix;
GlStateManager.enableTexture2D();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
fx = fx;
int lx = ix;
boolean bl1 = false;
boolean bl2 = false;
boolean bl3 = false;
boolean bl4 = false;
boolean bl5 = false;
int k;
for (int o = k = 0; o < string.length(); o = ++k) {
char c;
if ((c = string.charAt(k)) == 167 && k < string.length() - 1) {
char ex = Character.toLowerCase(string.charAt(++k));
if ("0123456789abcdef".indexOf(ex) >= 0) {
bl5 = false;
bl4 = false;
bl3 = false;
bl2 = false;
bl1 = false;
int n = fontRenderer1.getColorCode(ex);
lx = ix & 0xFF000000 | (bl ? (n & 16579836) >> 2 : n) & 16777215;
} else {
switch (ex) {
case 'k':
while (false) {
}
bl3 = true;
break;
case 'l':
bl1 = true;
break;
case 'm':
bl5 = true;
break;
case 'n':
bl4 = true;
break;
case 'o':
bl2 = true;
case 'p':
case 'q':
default:
break;
case 'r':
bl5 = false;
bl4 = false;
bl3 = false;
bl2 = false;
bl1 = false;
lx = ix;
}
}
} else {
char dx = bl3 ? L(c) : c;
if (!L(dx)) {
fx += L(fontRenderer1, dx, fx, g, lx, bl1) + L();
} else {
GlyphFont glyphFont2 = bl1 ? glyphFont1 : glyphFont;
float h = glyphFont.D(c) * mx + L() + (bl1 ? L(fontRenderer1) : 0.0F);
L(glyphFont2, dx, fx, g, mx, lx, bl2);
if (bl5) {
L(fx, g + 3.8500001F, h, lx);
}
if (bl4) {
L(fx, g + 7.0F + 1.0F, h, lx);
}
fx += h;
}
}
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.resetColor();
}
}
}
private static int d(FontRenderer fontRenderer, String string, float f, float g, int i, boolean bl) {
if (string == null) {
return 0;
}
if ((ix & -67108864) == 0) {
ix |= -16777216;
}
if (bl) {
L(fontRenderer, string, fx + 1.0F, g + 1.0F, L(ix), true);
}
L(fontRenderer, string, fx, g, ix, false);
return (int)(fx + L(fontRenderer, string));
}
private static float L(FontRenderer fontRenderer, char c) {
e = true;
try {
return fontRenderer.getCharWidth(c);
} finally {
e = false;
}
}
private static char L(char c) {
return c == ' ' ? c : "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".charAt(RANDOM.nextInt("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".length()));
}
private static TargetHudTextSettingsWeightMode L(TargetHudTextSettingsWeightMode targetHudTextSettingsWeightMode) {
switch (targetHudTextSettingsWeightModex) {
case REGULAR:
while (false) {
}
return TargetHudTextSettingsWeightMode.SEMI_BOLD;
case MEDIUM:
return TargetHudTextSettingsWeightMode.BOLD;
default:
return TargetHudTextSettingsWeightMode.BOLD;
}
}
private static FontStyle L(boolean bl) {
boolean bl1 = bl;
CustomGui customGui;
float fx = (customGui = CustomGuiState.L()) == null ? 1.0F : customGui.customGuiPart5.size.getFloat();
TargetHudTextSettingsWeightMode targetHudTextSettingsWeightModex = customGui == null
? TargetHudTextSettingsWeightMode.REGULAR
: customGui.customGuiPart5.weight.getValue().getTargetHudTextSettingsWeightMode();
if (fontStyle2 == null || fx != m || targetHudTextSettingsWeightModex != targetHudTextSettingsWeightMode) {
fontStyle2 = L(targetHudTextSettingsWeightModex, fx);
fontStyle = L(L(targetHudTextSettingsWeightModex), fx);
m = fx;
targetHudTextSettingsWeightMode = targetHudTextSettingsWeightModex;
}
return bl1 ? fontStyle : fontStyle2;
}
private static float L() {
CustomGui customGui;
return (customGui = CustomGuiState.L()) == null ? 0.0F : customGui.customGuiPart5.letterSpacing.getFloat();
}
public static int L(FontRenderer fontRenderer, String string, float f, float g, int i, boolean bl) {
FontRenderer fontRenderer1 = fontRenderer;
try {
return d(fontRenderer1, string, fx, g, ix, bl);
} catch (Throwable throwable) {
f = true;
e = false;
OnyxClient.LOGGER.warn("Custom GUI font stood down to the bitmap font after a failure", throwable);
return fontRenderer1.drawString(string, fx, g, ix, bl);
}
}
private FontRendererHook() {
}
public static void L() {
fontStyle2 = null;
fontStyle = null;
f = false;
}
public static int L(FontRenderer fontRenderer, String string) {
FontRenderer fontRenderer1 = fontRenderer;
if (string != null && !string.isEmpty()) {
float fx = 0.0F;
boolean bl = false;
int ix;
for (int jx = ix = 0; jx < string.length(); jx = ++ix) {
char c;
if ((c = string.charAt(ix)) == 167 && ix < string.length() - 1) {
char dx;
if ((dx = Character.toLowerCase(string.charAt(++ix))) == 'l') {
bl = true;
} else if (dx == 'r' || "0123456789abcdef".indexOf(dx) >= 0) {
bl = false;
}
} else {
fx += L(c) ? L(c) : L(fontRenderer1, c) + L();
if (bl) {
fx += fontRenderer1.offsetBold;
}
}
}
return Math.round(fx);
} else {
return 0;
}
}
private static void L(float f, float g, float h, int i) {
GlStateManager.disableTexture2D();
GL11.glColor4f((ix >> 16 & 0xFF) / 255.0F, (ix >> 8 & 0xFF) / 255.0F, (ix & 0xFF) / 255.0F, (ix >>> 24) / 255.0F);
GL11.glBegin(7);
GL11.glVertex2f(fx, g);
GL11.glVertex2f(fx, g + 1.0F);
GL11.glVertex2f(fx + h, g + 1.0F);
GL11.glVertex2f(fx + h, g);
GL11.glEnd();
GlStateManager.enableTexture2D();
}
private static int L(int i) {
return ix & 0xFF000000 | (ix & 16579836) >> 2;
}
public static boolean d() {
CustomGui customGui;
return !f && !e && CustomGuiState.l() ? (customGui = CustomGuiState.L()) != null && customGui.isEnabled() && customGui.customGuiPart5.isEnabled() : false;
}
private static float L(FontRenderer fontRenderer) {
return fontRenderer.offsetBold;
}
private static void L(GlyphFont glyphFont, char c, float f, float g, float h, int i, boolean bl) {
GlyphFontData glyphFontData;
if (!(glyphFontData = glyphFont.d(c)).L()) {
int jx;
if ((jx = glyphFont.L()) != -1) {
GlStateManager.bindTexture(jx);
GL11.glColor4f((ix >> 16 & 0xFF) / 255.0F, (ix >> 8 & 0xFF) / 255.0F, (ix & 0xFF) / 255.0F, (ix >>> 24) / 255.0F);
fx += glyphFontData.bearingX() * h;
float lx = g + 7.0F + glyphFontData.bearingY() * h;
float n = fx + glyphFontData.width() * h;
h = lx + glyphFontData.height() * h;
float k = bl ? (g + 7.0F - lx) * 0.2F : 0.0F;
float mx = bl ? (g + 7.0F - h) * 0.2F : 0.0F;
GL11.glBegin(7);
GL11.glTexCoord2f(glyphFontData.u0(), glyphFontData.v0());
GL11.glVertex2f(fx + k, lx);
GL11.glTexCoord2f(glyphFontData.u0(), glyphFontData.v1());
GL11.glVertex2f(fx + mx, h);
GL11.glTexCoord2f(glyphFontData.u1(), glyphFontData.v1());
GL11.glVertex2f(n + mx, h);
GL11.glTexCoord2f(glyphFontData.u1(), glyphFontData.v0());
GL11.glVertex2f(n + k, lx);
GL11.glEnd();
}
}
}
public static boolean L() {
CustomGui customGui;
return (customGui = CustomGuiState.L()) == null || customGui.customGuiPart5.shadow.isEnabled();
}
private static FontStyle L(TargetHudTextSettingsWeightMode targetHudTextSettingsWeightMode, float f) {
TargetHudTextSettingsWeightMode targetHudTextSettingsWeightMode1 = targetHudTextSettingsWeightModex;
FontFamilyMode fontFamilyMode = FontFamilyMode.PT24;
float g;
float h = (g = FontFamily.L(FontFamilyMode.PT24, targetHudTextSettingsWeightMode1).d() / fontFamilyMode.L()) > 0.0F ? 7.0F / g : fontFamilyMode.L();
return new FontStyle(fontFamilyMode, targetHudTextSettingsWeightMode1, h * fx, 9.0F);
}
}
@@ -0,0 +1,22 @@
package openonyx.render.group_w;
import openonyx.render.group_e.TargetHudTextSettingsWeightMode;
// $VF: synthetic class
class FontRendererHookPart {
static {
int[] i = new int[TargetHudTextSettingsWeightMode.values().length];
boolean bl = true;
e = i;
try {
e[TargetHudTextSettingsWeightMode.REGULAR.ordinal()] = 1;
} catch (NoSuchFieldError noSuchFieldError1) {
}
try {
e[TargetHudTextSettingsWeightMode.MEDIUM.ordinal()] = 2;
} catch (NoSuchFieldError noSuchFieldError) {
}
}
}