From 93fc36cde0c14a234019503bbbce333888cc0b35 Mon Sep 17 00:00:00 2001 From: winterflyt <36+winterflyt@noreply.skidsolutions.xyz> Date: Mon, 30 Nov 2026 06:17:00 +0200 Subject: [PATCH] Upload files to "src/openonyx/ui/internal" --- src/openonyx/ui/internal/UiButton.java | 196 ++++++++++++ src/openonyx/ui/internal/UiButtonMode.java | 18 ++ src/openonyx/ui/internal/UiSupport_566.java | 25 ++ src/openonyx/ui/internal/UiSupport_571.java | 168 ++++++++++ src/openonyx/ui/internal/UiSupport_578.java | 333 ++++++++++++++++++++ 5 files changed, 740 insertions(+) create mode 100644 src/openonyx/ui/internal/UiButton.java create mode 100644 src/openonyx/ui/internal/UiButtonMode.java create mode 100644 src/openonyx/ui/internal/UiSupport_566.java create mode 100644 src/openonyx/ui/internal/UiSupport_571.java create mode 100644 src/openonyx/ui/internal/UiSupport_578.java diff --git a/src/openonyx/ui/internal/UiButton.java b/src/openonyx/ui/internal/UiButton.java new file mode 100644 index 0000000..a91004a --- /dev/null +++ b/src/openonyx/ui/internal/UiButton.java @@ -0,0 +1,196 @@ +package openonyx.ui.internal; + +import openonyx.render.Render2D; +import openonyx.theme.Fonts; +import openonyx.theme.ThemeManager; +import openonyx.ui.RenderContext; +import openonyx.ui.UiComponent; +import openonyx.ui.UiSupport_545; + +public class UiButton extends UiComponent { + private static final float C = 16.0F; + private static final float J = 6.0F; + private String D; + public static final float c = 30.0F; + private static final float a = 18.0F; + private static final float k = 900.0F; + private final Runnable runnable; + private static final float M = 12.0F; + private String L; + private final UiSupport_545 uiSupport_545 = new UiSupport_545(); + private static final float m = 1.8F; + private final UiButtonMode uiButtonMode; + private boolean l; + private static final float I = 12.0F; + private float H; + + private boolean I() { + return this.I && !this.l; + } + + private void L(Render2D render2D, int i) { + UiButton uiButton1 = this; + float h = render2D.getTextWidth(Fonts.FONT_STYLE14, uiButton1.L); + float f = uiButton1.D == null ? 0.0F : 22.0F; + float j = uiButton1.f + (uiButton1.e - h - f) / 2.0F; + float g = uiButton1.d + uiButton1.i / 2.0F; + if (uiButton1.D != null) { + render2D.drawIcon(uiButton1.D, j + 8.0F, g, 16.0F, i); + j += f; + } + + render2D.drawTextVCentered(Fonts.FONT_STYLE14, uiButton1.L, j, g, i); + } + + @Override + public boolean mouseClicked(float f, float g, int i) { + if (i == 0 && this.I() && this.contains(f, g)) { + this.H = true; + this.runnable.run(); + return true; + } else { + return false; + } + } + + @Override + public void update(RenderContext renderContext) { + super.update(renderContext); + boolean bl; + UiButton uiButton1; + if (this.h && this.I()) { + bl = true; + uiButton1 = this; + } else { + bl = false; + uiButton1 = this; + } + + this.uiSupport_545.L(renderContext.i, bl, uiButton1.H && this.I()); + if (this.l) { + this.H = (this.H + renderContext.i) % 900.0F; + } + } + + @Override + public boolean mouseReleased(float f, float g, int i) { + return this.H = false; + } + + public void d(String string) { + this.D = string; + } + + public void d(boolean bl) { + this.l = bl; + } + + public void L(String string) { + this.L = string; + } + + public UiButton(UiButtonMode uiButtonMode, String string, String string1, Runnable runnable) { + this.uiButtonMode = uiButtonModex; + this.L = string; + this.D = string1; + this.runnable = runnablex; + this.i = 30.0F; + } + + public UiButton(UiButtonMode uiButtonMode, String string, Runnable runnable) { + this(uiButtonModex, string, null, runnablex); + } + + @Override + public void render(RenderContext renderContext) { + UiButton uiButton1 = this; + Render2D render2D = renderContext.render2D; + int i = uiButton1.L(renderContext); + int j = uiButton1.d(renderContext); + if (!uiButton1.I()) { + i = ThemeManager.disabled(i); + } + + if (j != 0) { + render2D.roundedRect( + uiButton1.f, + uiButton1.d, + uiButton1.e, + uiButton1.i, + Float.MAX_VALUE, + uiButton1.I() ? j : ThemeManager.withAlpha(renderContext.palette().onSurface(), 0.12F) + ); + } + + if (uiButton1.uiButtonMode == UiButtonMode.OUTLINED) { + render2D.roundedOutline( + uiButton1.f, + uiButton1.d, + uiButton1.e, + uiButton1.i, + Float.MAX_VALUE, + 1.0F, + uiButton1.I() ? renderContext.palette().outline() : ThemeManager.disabled(renderContext.palette().outline()) + ); + } + + uiButton1.uiSupport_545.L(render2D, uiButton1.f, uiButton1.d, uiButton1.e, uiButton1.i, Float.MAX_VALUE, i); + UiButton uiButton2; + if (uiButton1.l) { + uiButton2 = uiButton1; + render2D.L(uiButton1.f + uiButton1.e / 2.0F, uiButton1.d + uiButton1.i / 2.0F, 6.0F, 1.8F, uiButton1.H / 900.0F, i); + } else { + uiButton2 = uiButton1; + uiButton1.L(render2D, i); + } + + if (uiButton2.h && uiButton1.I()) { + render2D.usePointerCursor(); + } + } + + public float L(Render2D render2D) { + float f = this.uiButtonMode == UiButtonMode.TEXT ? 12.0F : 18.0F; + float h = render2D.getTextWidth(Fonts.FONT_STYLE14, this.L); + float g = this.D == null ? 0.0F : 22.0F; + return f * 2.0F + h + g; + } + + public boolean i() { + return this.l; + } + + private int d(RenderContext renderContext) { + switch (this.uiButtonMode) { + case OUTLINED: + while (false) { + } + + return renderContext.palette().primary(); + case FILLED: + return renderContext.palette().secondaryContainer(); + case TEXT: + case TONAL: + return 0; + default: + throw new MatchException(null, null); + } + } + + private int L(RenderContext renderContext) { + switch (this.uiButtonMode) { + case OUTLINED: + while (false) { + } + + return renderContext.palette().onPrimary(); + case FILLED: + return renderContext.palette().onSecondaryContainer(); + case TEXT: + case TONAL: + return renderContext.palette().primary(); + default: + throw new MatchException(null, null); + } + } +} diff --git a/src/openonyx/ui/internal/UiButtonMode.java b/src/openonyx/ui/internal/UiButtonMode.java new file mode 100644 index 0000000..912d289 --- /dev/null +++ b/src/openonyx/ui/internal/UiButtonMode.java @@ -0,0 +1,18 @@ +package openonyx.ui.internal; + +public enum UiButtonMode { + OUTLINED, + FILLED, + TEXT, + TONAL; + + private static UiButtonMode[] L() { + UiButtonMode[] uiButtonModes = new UiButtonMode[4]; + boolean bl = true; + uiButtonModes[0] = FILLED; + uiButtonModes[1] = TONAL; + uiButtonModes[2] = OUTLINED; + uiButtonModes[3] = TEXT; + return uiButtonModes; + } +} diff --git a/src/openonyx/ui/internal/UiSupport_566.java b/src/openonyx/ui/internal/UiSupport_566.java new file mode 100644 index 0000000..2caa4cc --- /dev/null +++ b/src/openonyx/ui/internal/UiSupport_566.java @@ -0,0 +1,25 @@ +package openonyx.ui.internal; + +import java.util.function.BooleanSupplier; + +public record UiSupport_566(String glyph, String label, boolean destructive, boolean divider, BooleanSupplier checked, boolean keepOpen, Runnable action) { + public static UiSupport_566 D(String string, String string1, Runnable runnable) { + return new UiSupport_566(string, string1, false, false, null, false, runnable); + } + + public static UiSupport_566 L() { + return new UiSupport_566(null, null, false, true, null, false, null); + } + + public static UiSupport_566 d(String string, String string1, Runnable runnable) { + return new UiSupport_566(string, string1, false, false, null, true, runnable); + } + + public static UiSupport_566 L(String string, BooleanSupplier booleanSupplier, Runnable runnable) { + return new UiSupport_566(null, string, false, false, booleanSupplier, true, runnable); + } + + public static UiSupport_566 L(String string, String string1, Runnable runnable) { + return new UiSupport_566(string, string1, true, false, null, false, runnable); + } +} diff --git a/src/openonyx/ui/internal/UiSupport_571.java b/src/openonyx/ui/internal/UiSupport_571.java new file mode 100644 index 0000000..9ed16e0 --- /dev/null +++ b/src/openonyx/ui/internal/UiSupport_571.java @@ -0,0 +1,168 @@ +package openonyx.ui.internal; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import openonyx.render.Render2D; +import openonyx.render.group_d.Animation; +import openonyx.render.group_d.Easings; +import openonyx.render.group_e.FontStyle; +import openonyx.theme.Fonts; +import openonyx.ui.RenderContext; +import openonyx.ui.UiComponent; + +public class UiSupport_571 extends UiComponent { + private float D; + private static final float c = 12.0F; + private static final float a = 34.0F; + private final Animation animation = new Animation(0.0F); + private boolean g; + private static final float M = 16.0F; + private static final float L = 13.0F; + private static final int j = 4; + private String m; + private static final float h = 10.0F; + private static final float l = 10.0F; + private static final float I = 16.0F; + private String i; + private static final int f = 3; + private static final float H = 380.0F; + + public void L(String string, String string1) { + this.L(string, string1, true); + } + + private boolean i() { + return this.i != null && (this.animation.getValue() > 0.001F || this.animation.getTarget() > 0.0F); + } + + public void d() { + this.D = 0.0F; + this.animation.animateTo(0.0F, 200.0F, Easings.EASING6); + } + + public void L(String string) { + this.L(string, null, false); + } + + @Override + public void render(RenderContext renderContext) { + UiSupport_571 uiSupport_5711 = this; + if (uiSupport_5711.i()) { + Render2D render2D = renderContext.render2D; + float hx = uiSupport_5711.animation.getValue(); + int k = uiSupport_5711.g ? renderContext.palette().errorContainer() : renderContext.palette().inverseSurface(); + int n = uiSupport_5711.g ? renderContext.palette().onErrorContainer() : renderContext.palette().inverseOnSurface(); + float gx = uiSupport_5711.m == null ? 0.0F : 26.0F; + float fx = Math.min(380.0F, uiSupport_5711.e) - 32.0F - gx; + List list = uiSupport_5711.L(render2D, fx); + float ix = 0.0F; + + Iterator iterator; + for (Iterator iterator3 = iterator = list.iterator(); iterator3.hasNext(); iterator3 = iterator) { + String string = (String)iterator.next(); + ix = Math.max(ix, render2D.getTextWidth(Fonts.FONT_STYLE15, string)); + } + + float o = 32.0F + gx + ix; + float p = Math.max(34.0F, 21.0F + list.size() * 13.0F); + ix = uiSupport_5711.f + (uiSupport_5711.e - o) / 2.0F; + float jx = uiSupport_5711.d + uiSupport_5711.i - 12.0F - p + 10.0F * (1.0F - hx); + render2D.D(); + render2D.pushAlpha(hx); + render2D.shadow(ix, jx, o, p, 4.0F, 3); + render2D.roundedRect(ix, jx, o, p, 4.0F, k); + hx = ix + 16.0F; + float lx = jx + p / 2.0F; + if (uiSupport_5711.m != null) { + render2D.drawIcon(uiSupport_5711.m, hx + 8.0F, lx, 16.0F, n); + hx += gx; + } + + float mx = lx - (list.size() - 1) * 13.0F / 2.0F; + + for (Iterator iterator2 = iterator1 = list.iterator(); iterator2.hasNext(); mx += 13.0F) { + String string1 = (String)iterator1.next(); + iterator2 = iterator1; + render2D.drawTextVCentered(Fonts.FONT_STYLE15, string1, hx, mx, n); + } + + render2D.popAlpha(); + } + } + + private List L(Render2D render2D, float f) { + UiSupport_571 uiSupport_5711 = this; + ArrayList arrayList = new ArrayList(); + StringBuilder stringBuilder = new StringBuilder(); + String[] strings; + int ix = (strings = uiSupport_5711.i.split(" ")).length; + int jx; + int mx = jx = 0; + + while (true) { + if (mx >= ix) { + arrayList1 = arrayList; + break; + } + + String string; + if (!(string = strings[jx]).isEmpty()) { + String string1 = stringBuilder.isEmpty() ? string : stringBuilder + " " + string; + if (!(render2D.getTextWidth(Fonts.FONT_STYLE15, string1) <= fx) && !stringBuilder.isEmpty()) { + arrayList.add(stringBuilder.toString()); + stringBuilder.setLength(0); + stringBuilder.append(string); + if (arrayList.size() == 4) { + arrayList1 = arrayList; + break; + } + } else { + stringBuilder.setLength(0); + stringBuilder.append(string1); + } + } + + mx = ++jx; + } + + if (arrayList1.size() < 4 && !stringBuilder.isEmpty()) { + arrayList.add(stringBuilder.toString()); + } + + for (int lx = k = 0; lx < arrayList.size(); lx = k) { + int n = k; + FontStyle fontStyle = Fonts.FONT_STYLE15; + String string2 = (String)arrayList.get(k); + k++; + arrayList.set(n, render2D.trimToWidth(fontStyle, string2, fx)); + } + + return arrayList; + } + + public void L(String string, String string1, boolean bl) { + this.i = string; + this.m = string1; + this.g = bl; + this.D = 800.0F * (bl ? 2.0F : 1.0F); + this.animation.animateTo(1.0F, 300.0F, Easings.EASING7); + } + + @Override + public void update(RenderContext renderContext) { + if (this.i != null) { + if (this.D > 0.0F) { + this.D = this.D - renderContext.i; + if (this.D <= 0.0F) { + this.d(); + } + } + + this.animation.update(renderContext.i); + if (this.animation.getTarget() == 0.0F && this.animation.isFinished()) { + this.i = null; + } + } + } +} diff --git a/src/openonyx/ui/internal/UiSupport_578.java b/src/openonyx/ui/internal/UiSupport_578.java new file mode 100644 index 0000000..0e4e3fb --- /dev/null +++ b/src/openonyx/ui/internal/UiSupport_578.java @@ -0,0 +1,333 @@ +package openonyx.ui.internal; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import openonyx.input.KeyInput; +import openonyx.render.Render2D; +import openonyx.render.group_d.Animation; +import openonyx.render.group_d.Easings; +import openonyx.theme.AlphaLevels; +import openonyx.theme.Fonts; +import openonyx.ui.MaterialIcons; +import openonyx.ui.RenderContext; +import openonyx.ui.UiComponent; +import openonyx.ui.UiSupport_545; + +public class UiSupport_578 extends UiComponent { + private final List uiSupport_545s; + private static final float A = 10.0F; + private static final float K = 6.0F; + private static final float B = 16.0F; + private static final float C = 7.0F; + private float J; + private final Animation animation; + private static final float c = 10.0F; + private final List uiSupport_566s = new ArrayList<>(); + private static final float k = 0.85F; + private static final float g = 30.0F; + private float M; + private float L; + private static final int j = 2; + private float m; + private static final float h = 12.0F; + private boolean l; + private static final float I = 150.0F; + private boolean f; + private static final float H = 14.0F; + + public boolean i() { + return this.f; + } + + @Override + public boolean mouseClicked(float f, float g, int i) { + if (!this.f) { + return false; + } + + if (!this.contains(fx, gx)) { + this.d(); + return true; + } + + if (i != 0) { + return true; + } + + int jx; + if ((jx = this.L(gx)) >= 0) { + UiSupport_566 uiSupport_566 = this.uiSupport_566s.get(jx); + Runnable runnable = uiSupport_566.action(); + if (!uiSupport_566.keepOpen()) { + this.d(); + } + + if (runnable != null) { + runnable.run(); + } + } + + return true; + } + + public UiSupport_578() { + this.uiSupport_545s = new ArrayList<>(); + this.animation = new Animation(0.0F); + } + + public void d(List list, UiComponent uiComponent, UiComponent uiComponent1, Render2D render2D) { + this.L(list, uiComponent1, render2D); + float fx = uiComponent.d() + uiComponent.i(); + float gx = uiComponent.D() + uiComponent.L(); + this.f = Math.clamp(fx - this.e, uiComponent1.d() + 6.0F, uiComponent1.d() + uiComponent1.i() - this.e - 6.0F); + this.l = gx + this.i > uiComponent1.D() + uiComponent1.L() - 6.0F; + float hx; + UiComponent uiComponent2; + if (this.l) { + hx = uiComponent.D() - this.i; + uiComponent2 = uiComponent1; + } else { + hx = gx; + uiComponent2 = uiComponent1; + } + + this.d = Math.clamp(hx, uiComponent2.D() + 6.0F, uiComponent1.D() + uiComponent1.L() - this.i - 6.0F); + this.J = fx; + this.M = this.l ? this.d + this.i : this.d; + this.animation.set(0.0F).animateTo(1.0F, 200.0F, Easings.EASING7); + } + + @Override + public void update(RenderContext renderContext) { + if (this.f) { + this.animation.update(renderContext.i); + this.h = this.contains(renderContext.H, renderContext.f); + int i = this.h ? this.L(renderContext.f) : -1; + + int jx; + for (int kx = jx = 0; kx < this.uiSupport_545s.size(); kx = jx) { + UiSupport_545 uiSupport_545 = this.uiSupport_545s.get(jx); + boolean bl = jx == i; + jx++; + uiSupport_545.L(renderContext.i, bl, false); + } + } + } + + public void d() { + if (this.f) { + this.f = false; + this.uiSupport_566s.clear(); + this.uiSupport_545s.clear(); + this.L = 0.0F; + this.m = 0.0F; + } + } + + @Override + public boolean keyTyped(KeyInput keyInput) { + if (this.f && keyInput.key() == 1) { + this.d(); + return true; + } else { + return false; + } + } + + private float I() { + UiSupport_578 uiSupport_5781 = this; + float fx = 12.0F; + + Iterator iterator; + for (Iterator iterator1 = iterator = uiSupport_5781.uiSupport_566s.iterator(); iterator1.hasNext(); iterator1 = iterator) { + UiSupport_566 uiSupport_566 = (UiSupport_566)iterator.next(); + fx += uiSupport_566.divider() ? 7.0F : 30.0F; + } + + return fx; + } + + private void L(List list, UiComponent uiComponent, Render2D render2D) { + this.uiSupport_566s.clear(); + this.uiSupport_545s.clear(); + this.uiSupport_566s.addAll(list); + Iterator iterator = list.iterator(); + Iterator iterator1 = iterator; + + while (iterator1.hasNext()) { + UiSupport_566 uiSupport_566 = (UiSupport_566)iterator.next(); + iterator1 = iterator; + this.uiSupport_545s.add(new UiSupport_545()); + } + + this.e = this.L(render2D); + this.L = this.I(); + this.i = Math.min(this.L, uiComponent.L() - 12.0F); + this.m = 0.0F; + this.f = true; + } + + public void L(List list, UiComponent uiComponent, UiComponent uiComponent1, Render2D render2D) { + this.L(list, uiComponent1, render2D); + float fx; + boolean bl = (fx = uiComponent.d() + uiComponent.i()) + this.e > uiComponent1.d() + uiComponent1.i() - 6.0F; + float gx; + UiComponent uiComponent2; + if (bl) { + gx = uiComponent.d() - this.e; + uiComponent2 = uiComponent1; + } else { + gx = fx; + uiComponent2 = uiComponent1; + } + + this.f = Math.clamp(gx, uiComponent2.d() + 6.0F, uiComponent1.d() + uiComponent1.i() - this.e - 6.0F); + this.d = Math.clamp(uiComponent.D(), uiComponent1.D() + 6.0F, uiComponent1.D() + uiComponent1.L() - this.i - 6.0F); + this.l = bl; + this.J = bl ? this.f + this.e : this.f; + this.M = this.d; + this.animation.set(0.0F).animateTo(1.0F, 200.0F, Easings.EASING7); + } + + @Override + public void render(RenderContext renderContext) { + UiSupport_578 uiSupport_5781 = this; + if (uiSupport_5781.f) { + Render2D render2D; + Render2D render2D1 = render2D = renderContext.render2D; + float kx = uiSupport_5781.animation.getValue(); + render2D.D(); + render2D.pushAlpha(kx); + render2D.pushMatrix(); + render2D.scaleAround(0.85F + 0.14999998F * kx, uiSupport_5781.J, uiSupport_5781.M); + render2D.shadow(uiSupport_5781.f, uiSupport_5781.d, uiSupport_5781.e, uiSupport_5781.i, 4.0F, 2); + render2D.roundedRect(uiSupport_5781.f, uiSupport_5781.d, uiSupport_5781.e, uiSupport_5781.i, 4.0F, AlphaLevels.L(2, renderContext.palette())); + render2D1.pushScissor(uiSupport_5781.f, uiSupport_5781.d, uiSupport_5781.e, uiSupport_5781.i); + float lx = uiSupport_5781.d + 6.0F - uiSupport_5781.m; + + int i; + for (int q = i = 0; q < uiSupport_5781.uiSupport_566s.size(); q = ++i) { + UiSupport_566 uiSupport_566; + if ((uiSupport_566 = uiSupport_5781.uiSupport_566s.get(i)).divider()) { + if (lx + 7.0F >= uiSupport_5781.d && lx <= uiSupport_5781.d + uiSupport_5781.i) { + render2D.rect(uiSupport_5781.f + 12.0F, lx + 3.5F, uiSupport_5781.e - 24.0F, 1.0F, renderContext.palette().outlineVariant()); + } + + lx += 7.0F; + } else if (!(lx + 30.0F < uiSupport_5781.d) && !(lx > uiSupport_5781.d + uiSupport_5781.i)) { + int jx = uiSupport_566.destructive() ? renderContext.palette().error() : renderContext.palette().onSurface(); + uiSupport_5781.uiSupport_545s.get(i).L(render2D, uiSupport_5781.f, lx, uiSupport_5781.e, 30.0F, 0.0F, jx); + float fx = uiSupport_5781.f + 12.0F; + if (uiSupport_566.checked() != null) { + boolean bl = uiSupport_566.checked().getAsBoolean(); + float gx = fx + 1.0F; + float hx = lx + 8.0F; + float r; + if (bl) { + render2D.roundedRect(gx, hx, 14.0F, 14.0F, 4.0F, renderContext.palette().primary()); + r = fx; + MaterialIcons.d(render2D, gx + 7.0F, hx + 7.0F, 10.0F, renderContext.palette().onPrimary()); + } else { + render2D.roundedOutline(gx, hx, 14.0F, 14.0F, 4.0F, 1.0F, renderContext.palette().onSurfaceVariant()); + r = fx; + } + + fx = r + 26.0F; + render2D1 = render2D; + } else { + if (uiSupport_566.glyph() != null) { + render2D.drawIcon( + uiSupport_566.glyph(), fx + 8.0F, lx + 15.0F, 16.0F, uiSupport_566.destructive() ? jx : renderContext.palette().onSurfaceVariant() + ); + fx += 26.0F; + } + + render2D1 = render2D; + } + + render2D1.drawTextVCentered( + Fonts.FONT_STYLE14, + render2D.trimToWidth(Fonts.FONT_STYLE14, uiSupport_566.label(), uiSupport_5781.f + uiSupport_5781.e - 12.0F - fx), + fx, + lx + 15.0F, + jx + ); + lx += 30.0F; + } else { + lx += 30.0F; + } + } + + render2D.popScissor(); + float mx; + if ((mx = Math.max(0.0F, uiSupport_5781.L - uiSupport_5781.i)) > 0.0F) { + float n = uiSupport_5781.i - 12.0F; + float o = Math.max(24.0F, n * uiSupport_5781.i / uiSupport_5781.L); + float p = uiSupport_5781.d + 6.0F + (n - o) * uiSupport_5781.m / mx; + render2D.roundedRect(uiSupport_5781.f + uiSupport_5781.e - 5.0F, p, 3.0F, o, Float.MAX_VALUE, renderContext.palette().outlineVariant()); + } + + render2D.popMatrix(); + render2D.popAlpha(); + if (uiSupport_5781.h) { + render2D.usePointerCursor(); + } + } + } + + private int L(float f) { + UiSupport_578 uiSupport_5781 = this; + float hx = uiSupport_5781.d + 6.0F - uiSupport_5781.m; + + int i; + for (int jx = i = 0; jx < uiSupport_5781.uiSupport_566s.size(); jx = i) { + UiSupport_566 uiSupport_566; + float gx = (uiSupport_566 = uiSupport_5781.uiSupport_566s.get(i)).divider() ? 7.0F : 30.0F; + if (!uiSupport_566.divider() && fx >= hx && fx < hx + gx) { + return i; + } + + i++; + hx += gx; + } + + return -1; + } + + private float L(Render2D render2D) { + UiSupport_578 uiSupport_5781 = this; + float fx = 150.0F; + Iterator iterator; + Iterator iterator1 = iterator = uiSupport_5781.uiSupport_566s.iterator(); + + while (iterator1.hasNext()) { + UiSupport_566 uiSupport_566; + if ((uiSupport_566 = (UiSupport_566)iterator.next()).divider()) { + iterator1 = iterator; + } else { + float gx = render2D.getTextWidth(Fonts.FONT_STYLE14, uiSupport_566.label()); + float hx = uiSupport_566.glyph() == null && uiSupport_566.checked() == null ? 0.0F : 26.0F; + fx = Math.max(fx, 24.0F + hx + gx); + iterator1 = iterator; + } + } + + return fx; + } + + @Override + public boolean mouseScrolled(float f, float g, double d) { + if (!this.f) { + return false; + } + + if (!this.contains(fx, gx)) { + return true; + } + + fx = Math.max(0.0F, this.L - this.i); + this.m = Math.clamp(this.m - (float)d * 30.0F, 0.0F, fx); + return true; + } +}