diff --git a/src/openonyx/ui/AccountList.java b/src/openonyx/ui/AccountList.java new file mode 100644 index 0000000..e2f3dec --- /dev/null +++ b/src/openonyx/ui/AccountList.java @@ -0,0 +1,69 @@ +package openonyx.ui; + +import java.util.Iterator; +import java.util.List; +import java.util.function.Consumer; +import openonyx.connection.Account; +import openonyx.core.OnyxClient; +import openonyx.theme.Fonts; +import openonyx.ui.internal.AccountRow; + +public class AccountList extends ScrollList { + private final Consumer accountRowConsumer; + private static final float l = 5.0F; + private static final float H = 9.0F; + private final Consumer accountRowConsumer2; + + public AccountList(Consumer consumer, Consumer consumer1) { + this.accountRowConsumer = consumer; + this.accountRowConsumer2 = consumer1; + this.d(); + } + + @Override + public void d() { + AccountList accountList1 = this; + accountList1.uiComponents.clear(); + accountList1.m = 0.0F; + accountList1.animation.set(0.0F); + List list; + int i = (list = OnyxClient.accountManager.L()).size() - 1; + + for (int j = i; j >= 0; j = i) { + List list1 = accountList1.uiComponents; + Account account = (Account)list.get(i); + i--; + list1.add(new AccountRow(account, accountList1.accountRowConsumer, accountList1.accountRowConsumer2)); + } + } + + @Override + public boolean mouseClicked(float f, float g, int i) { + return this.contains(f, g) && super.mouseClicked(f, g, i); + } + + @Override + public void render(RenderContext renderContext) { + if (this.uiComponents.isEmpty()) { + renderContext.render2D + .drawTextCenteredVCentered( + Fonts.FONT_STYLE15, "No accounts yet", this.f + this.e / 2.0F, this.d + this.i / 2.0F, renderContext.palette().onSurfaceVariant() + ); + } else { + super.render(renderContext); + } + } + + @Override + protected void i(RenderContext renderContext) { + float f = this.d - this.animation.getValue(); + + Iterator iterator; + for (Iterator iterator1 = iterator = this.uiComponents.iterator(); iterator1.hasNext(); iterator1 = iterator) { + ((UiComponent)iterator.next()).setBounds(this.f, f, this.e - 9.0F, 56.0F); + f += 61.0F; + } + + this.I = this.uiComponents.isEmpty() ? 0.0F : this.uiComponents.size() * 61.0F - 5.0F; + } +} diff --git a/src/openonyx/ui/AccountsPanel.java b/src/openonyx/ui/AccountsPanel.java new file mode 100644 index 0000000..257bb74 --- /dev/null +++ b/src/openonyx/ui/AccountsPanel.java @@ -0,0 +1,484 @@ +package openonyx.ui; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.gui.GuiScreen; +import openonyx.connection.Account; +import openonyx.connection.AccountManager; +import openonyx.connection.AccountType; +import openonyx.connection.ProfileSkinCache; +import openonyx.core.OnyxClient; +import openonyx.input.CharInput; +import openonyx.input.KeyInput; +import openonyx.render.Render2D; +import openonyx.render.RenderSupport_120; +import openonyx.render.group_d.Animation; +import openonyx.render.group_d.Easings; +import openonyx.theme.AlphaLevels; +import openonyx.theme.Fonts; +import openonyx.theme.ThemeManager; +import openonyx.ui.internal.AccountRow; +import openonyx.ui.internal.AddAccountPanel; +import openonyx.ui.internal.ProxyEditor; +import openonyx.ui.internal.UiButton; +import openonyx.ui.internal.UiButtonMode; +import openonyx.ui.internal.UiSupport_566; +import openonyx.ui.internal.UiSupport_571; +import openonyx.ui.internal.UiSupport_578; +import openonyx.ui.internal.UiSupport_602; + +public class AccountsPanel extends UiComponent { + private final UiSupport_571 y; + private float n; + private static final float Y = 34.0F; + private boolean r; + private final UiSupport_578 uiSupport_578; + private static final float P = 36.0F; + private float V; + private final Animation animation; + private final AccountList accountList; + private float t; + private static float b; + private static final float E = 12.0F; + private float F; + private static float G; + private final UiSupport_602 uiSupport_602; + private static final float K = 82.0F; + private boolean B; + private final AddAccountPanel addAccountPanel = new AddAccountPanel(); + private static final float J = 12.0F; + private float D; + private float c; + private final UiButton uiButton; + private float k; + private static final float g = 400.0F; + private boolean M; + private static final float L = 4.0F; + private final ProxyEditor proxyEditor = new ProxyEditor(); + private static final float m = 96.0F; + private static final String h = "Accounts"; + private final UiButton uiButton2; + private static final float I = 46.0F; + private final UiButton uiButton3; + private AccountRow accountRow; + private static final float H = 560.0F; + + @Override + public boolean mouseReleased(float f, float g, int i) { + this.M = false; + if (this.B) { + return this.addAccountPanel.mouseReleased(f, gx, i); + } else { + return this.r + ? this.proxyEditor.mouseReleased(f, gx, i) + : this.uiButton2.mouseReleased(f, gx, i) + | this.uiButton.mouseReleased(f, gx, i) + | this.uiButton3.mouseReleased(f, gx, i) + | this.accountList.mouseReleased(f, gx, i); + } + } + + private void L(RenderContext renderContext, Render2D render2D) { + float f = this.d + this.i - 17.0F; + render2D.rect(this.f + 12.0F, this.d + this.i - 34.0F, this.e - 24.0F, 1.0F, renderContext.palette().outlineVariant()); + render2D.drawTextVCentered( + Fonts.FONT_STYLE2, + render2D.trimToWidth(Fonts.FONT_STYLE2, this.L(), this.uiButton.d() - this.f - 24.0F), + this.f + 12.0F + 4.0F, + f, + renderContext.palette().onSurfaceVariant() + ); + this.uiButton.render(renderContext); + this.uiButton3.render(renderContext); + } + + private void d(float f, float g) { + this.setBounds(Math.round(Math.clamp(f, 96.0F - this.e, this.k - 96.0F)), Math.round(Math.clamp(gx, 0.0F, this.F - 46.0F)), this.e, this.i); + b = this.f - this.c; + G = this.d - this.t; + } + + private static String L(Throwable throwable) { + Throwable throwable1 = throwable; + throwable = throwable1.getCause() == null ? throwable1 : throwable1.getCause(); + return throwable.getMessage() == null ? throwable.toString() : throwable.getMessage(); + } + + private void L(String string, String string1) { + if (string1 != null && !string1.isBlank()) { + GuiScreen.setClipboardString(string1); + this.y.L(new StringBuilder().insert(0, string).append(" copied").toString()); + } else { + this.L("Nothing to copy"); + } + } + + @Override + public boolean mouseClicked(float f, float g, int i) { + if (this.uiSupport_578.mouseClicked(f, gx, i)) { + return true; + } + + if (this.B) { + if (this.uiSupport_602.mouseClicked(f, gx, i)) { + return true; + } + + if (this.addAccountPanel.mouseClicked(f, gx, i)) { + return true; + } + } else if (this.r) { + if (this.uiSupport_602.mouseClicked(f, gx, i)) { + return true; + } + + if (this.proxyEditor.mouseClicked(f, gx, i)) { + return true; + } + } else { + if (this.uiButton2.mouseClicked(f, gx, i)) { + return true; + } + + if (this.uiButton.mouseClicked(f, gx, i)) { + return true; + } + + if (this.uiButton3.mouseClicked(f, gx, i)) { + return true; + } + + if (this.accountList.mouseClicked(f, gx, i)) { + return true; + } + } + + if (i == 0 && f >= this.f && f < this.f + this.e && gx >= this.d && gx < this.d + 46.0F) { + this.M = true; + this.D = f - this.f; + this.n = gx - this.d; + return true; + } else { + return this.contains(f, gx); + } + } + + public float l() { + return this.f + this.e / 2.0F; + } + + private AccountManager L() { + return OnyxClient.accountManager; + } + + @Override + public boolean mouseScrolled(float f, float g, double d) { + return this.uiSupport_578.mouseScrolled(f, gx, d) ? true : !this.B && !this.r && this.accountList.mouseScrolled(f, gx, d); + } + + private List L(AccountRow accountRow) { + AccountsPanel accountsPanel1 = this; + Account account = accountRowx.getAccount(); + ArrayList arrayList; + (arrayList = new ArrayList()).add(UiSupport_566.D("\ue7fd", "Copy username", () -> this.L("Username", account.D()))); + arrayList.add(UiSupport_566.D("\ue14d", "Copy UUID", () -> this.L("UUID", account.getUuid() == null ? null : account.getUuid().toString()))); + if (account.getAccountType() != AccountType.OFFLINE) { + arrayList.add(UiSupport_566.D("\ue73c", "Copy access token", () -> this.L("Access token", account.d()))); + if (account.L() != null) { + arrayList.add(UiSupport_566.D("\ue73c", "Copy OAuth refresh token", () -> this.L("Refresh token", account.L()))); + } + + arrayList.add(UiSupport_566.L()); + arrayList.add(UiSupport_566.D("\ue5d5", "Refresh tokens", () -> this.d(accountRowx))); + } + + arrayList.add(UiSupport_566.L()); + arrayList.add(UiSupport_566.L("\ue872", "Delete", () -> this.L(account))); + return arrayList; + } + + private void d(AccountRow accountRow) { + accountRowx.d(true); + this.L().L(accountRowx.getAccount()).whenComplete((void_, throwable) -> mc.addScheduledTask(() -> { + accountRowx.d(false); + if (throwable == null) { + this.y.L(new StringBuilder().insert(0, "Refreshed ").append(accountRowx.getAccount().D()).toString()); + } else { + this.L(L(throwable)); + } + })); + } + + @Override + public boolean keyTyped(KeyInput keyInput) { + if (this.uiSupport_578.keyTyped(keyInput)) { + return true; + } else { + return this.B ? this.addAccountPanel.keyTyped(keyInput) : this.r && this.proxyEditor.keyTyped(keyInput); + } + } + + private String L() { + AccountsPanel accountsPanel1 = this; + Account account = accountsPanel1.L().getAccount(); + return new StringBuilder().insert(0, "Session: ").append(account == null ? mc.getSession().getUsername() : account.D()).toString(); + } + + public void L(float f) { + this.V = f; + } + + public AccountsPanel() { + this.uiSupport_578 = new UiSupport_578(); + this.y = new UiSupport_571(); + this.animation = new Animation(0.0F); + this.V = 1.0F; + this.e = 560.0F; + this.i = 400.0F; + this.accountList = new AccountList(accountRow -> { + if (accountRowx.getAccount() != this.L().getAccount()) { + accountRowx.d(true); + this.L().d(accountRowx.getAccount()).whenComplete((void_, throwable) -> mc.addScheduledTask(() -> { + accountRowx.d(false); + if (throwable == null) { + this.y.L(new StringBuilder().insert(0, "Logged in as ").append(accountRowx.getAccount().D()).toString()); + } else { + this.L(L(throwable)); + } + })); + } + }, accountRow -> this.accountRow = accountRowx); + this.uiButton2 = new UiButton(UiButtonMode.FILLED, "Add", "\ue145", this::D); + this.uiButton = new UiButton(UiButtonMode.TEXT, "Proxy settings", "\ue8b8", () -> { + if (!this.B && !this.r) { + this.uiSupport_578.d(); + this.proxyEditor.I(); + this.r = true; + this.animation.animateTo(1.0F, 300.0F, Easings.EASING2); + } + }); + this.uiButton3 = new UiButton(UiButtonMode.TEXT, "Restore launcher", () -> { + this.L().L(); + this.y.L("Restored the launcher account"); + }); + this.uiSupport_602 = new UiSupport_602("\ue5c4", this::i); + this.addAccountPanel.D(account -> { + this.accountList.d(); + this.i(); + this.y.L(new StringBuilder().insert(0, "Added ").append(account.D()).toString()); + }); + this.addAccountPanel.d(string -> this.y.L(string, "\ue001")); + this.addAccountPanel.L(this.y::L); + this.proxyEditor.d(this.y::L); + this.proxyEditor.L(string -> this.y.L(string, "\ue001")); + this.uiComponents.add(this.uiButton2); + this.uiComponents.add(this.accountList); + this.uiComponents.add(this.uiButton); + this.uiComponents.add(this.uiButton3); + this.uiComponents.add(this.uiSupport_602); + this.uiComponents.add(this.addAccountPanel); + this.uiComponents.add(this.proxyEditor); + } + + public void D() { + if (!this.B && !this.r) { + this.uiSupport_578.d(); + this.addAccountPanel.D(); + this.B = true; + this.animation.animateTo(1.0F, 300.0F, Easings.EASING2); + } + } + + @Override + protected void L() { + AccountsPanel accountsPanel1 = this; + float f = accountsPanel1.d + 46.0F; + float gx = accountsPanel1.e - 24.0F; + accountsPanel1.uiSupport_602.setBounds(accountsPanel1.f + 12.0F, accountsPanel1.h() - 15.0F, 30.0F, 30.0F); + accountsPanel1.uiButton2.setBounds(accountsPanel1.f + accountsPanel1.e - 12.0F - 82.0F, accountsPanel1.h() - 15.0F, 82.0F, 30.0F); + accountsPanel1.accountList.setBounds(accountsPanel1.f + 12.0F, f, gx, accountsPanel1.i - 46.0F - 34.0F); + accountsPanel1.addAccountPanel.setBounds(accountsPanel1.f + 12.0F, f, gx, accountsPanel1.i - 46.0F - 12.0F); + accountsPanel1.proxyEditor.setBounds(accountsPanel1.f + 12.0F, f, gx, accountsPanel1.i - 46.0F - 12.0F); + accountsPanel1.y.setBounds(accountsPanel1.f, accountsPanel1.d, accountsPanel1.e, accountsPanel1.i); + } + + private void D(RenderContext renderContext) { + Render2D render2D = renderContext.render2D; + float f = this.d + this.i - 17.0F; + float gx = this.uiButton3.L(render2D); + this.uiButton3.setBounds(this.f + this.e - 12.0F - gx, f - 15.0F, gx, 30.0F); + this.uiButton3.L(this.L().getAccount() != null); + float hx = this.uiButton.L(render2D); + this.uiButton.setBounds(this.uiButton3.d() - hx, f - 15.0F, hx, 30.0F); + } + + @Override + public void update(RenderContext renderContext) { + this.D(renderContext); + this.animation.update(renderContext.i); + this.h = this.contains(renderContext.H, renderContext.f); + float f; + if ((f = this.animation.getValue()) < 0.999F) { + this.uiButton2.update(renderContext); + this.accountList.update(renderContext); + this.uiButton.update(renderContext); + this.uiButton3.update(renderContext); + } + + AccountsPanel accountsPanel1; + label21: { + if (f > 0.001F) { + this.uiSupport_602.update(renderContext); + if (this.B) { + this.addAccountPanel.update(renderContext); + accountsPanel1 = this; + break label21; + } + + this.proxyEditor.update(renderContext); + } + + accountsPanel1 = this; + } + + if (accountsPanel1.accountRow != null) { + this.uiSupport_578.d(this.L(this.accountRow), this.accountRow.getUiSupport_602(), this, renderContext.render2D); + this.accountRow = null; + } + + this.uiSupport_578.update(renderContext); + this.y.update(renderContext); + } + + private float h() { + return this.d + 23.0F; + } + + @Override + public boolean charTyped(CharInput charInput) { + return this.B ? this.addAccountPanel.charTyped(charInput) : this.r && this.proxyEditor.charTyped(charInput); + } + + @Override + public void render(RenderContext renderContext) { + AccountsPanel accountsPanel1 = this; + Render2D render2D = renderContext.render2D; + Render2D render2D1 = renderContext.render2D; + Render2D render2D3 = renderContext.render2D; + Render2D render2D2 = renderContext.render2D; + render2D.pushAlpha(accountsPanel1.V); + render2D3.shadow(accountsPanel1.f, accountsPanel1.d, accountsPanel1.e, accountsPanel1.i, 28.0F, 3); + render2D2.popAlpha(); + RenderSupport_120.L( + render2D1, + accountsPanel1.f, + accountsPanel1.d, + accountsPanel1.e, + accountsPanel1.i, + 28.0F, + ThemeManager.withAlpha(AlphaLevels.L(2, renderContext.palette()), accountsPanel1.V) + ); + float f; + if ((f = accountsPanel1.animation.getValue()) < 0.999F) { + float gx; + float i = gx = accountsPanel1.V * (1.0F - f); + render2D.drawTextVCentered( + Fonts.FONT_STYLE18, + "Accounts", + accountsPanel1.f + 12.0F + 4.0F, + accountsPanel1.h(), + ThemeManager.withAlpha(renderContext.palette().onSurface(), gx) + ); + render2D.pushAlpha(i); + accountsPanel1.uiButton2.render(renderContext); + render2D.popAlpha(); + render2D.pushAlpha(gx); + render2D.pushMatrix(); + render2D.translate(-36.0F * f, 0.0F); + accountsPanel1.accountList.render(renderContext); + accountsPanel1.L(renderContext, render2D); + render2D.popMatrix(); + render2D.popAlpha(); + } + + if (f > 0.001F) { + float hx; + render2D.pushAlpha(hx = accountsPanel1.V * f); + accountsPanel1.uiSupport_602.render(renderContext); + String string; + AccountsPanel accountsPanel2; + if (accountsPanel1.B) { + string = "Add account"; + accountsPanel2 = accountsPanel1; + } else { + string = "Proxy settings"; + accountsPanel2 = accountsPanel1; + } + + render2D.drawTextVCentered( + Fonts.FONT_STYLE18, string, accountsPanel2.uiSupport_602.d() + 30.0F + 6.0F, accountsPanel1.h(), renderContext.palette().onSurface() + ); + render2D.popAlpha(); + render2D.pushAlpha(hx); + render2D.pushMatrix(); + render2D.translate(36.0F * (1.0F - f), 0.0F); + if (accountsPanel1.B) { + accountsPanel1.addAccountPanel.render(renderContext); + render2D1 = render2D; + } else { + accountsPanel1.proxyEditor.render(renderContext); + render2D1 = render2D; + } + + render2D1.popMatrix(); + render2D.popAlpha(); + } + + accountsPanel1.uiSupport_578.render(renderContext); + accountsPanel1.y.render(renderContext); + } + + public void L(float f, float g) { + this.k = f; + this.F = gx; + this.c = (f - this.e) / 2.0F; + this.t = (gx - this.i) / 2.0F; + this.d(this.c + b, this.t + G); + } + + @Override + public boolean mouseDragged(float f, float g, int i, float h, float j) { + if (!this.M) { + return false; + } + + this.d(f - this.D, gx - this.n); + return true; + } + + public float I() { + return this.d + this.i / 2.0F; + } + + private void L(Account account) { + ProfileSkinCache.L(account.getUuid()); + this.L().L(account); + this.accountList.d(); + this.y.L(new StringBuilder().insert(0, "Removed ").append(account.D()).toString()); + } + + public boolean i() { + if (!this.B && !this.r) { + return false; + } + + if (this.B) { + this.addAccountPanel.D(); + } + + this.B = false; + this.r = false; + this.animation.animateTo(0.0F, 300.0F, Easings.EASING2); + return true; + } +} diff --git a/src/openonyx/ui/CapeEditor.java b/src/openonyx/ui/CapeEditor.java new file mode 100644 index 0000000..a535559 --- /dev/null +++ b/src/openonyx/ui/CapeEditor.java @@ -0,0 +1,273 @@ +package openonyx.ui; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.ResourceLocation; +import openonyx.core.OnyxClient; +import openonyx.features.render.CapeChanger; +import openonyx.render.Render2D; +import openonyx.render.TextureFilter; +import openonyx.render.group_g.FitMode; +import openonyx.render.group_g.ImageUtils; +import openonyx.theme.Fonts; +import openonyx.theme.ThemeManager; +import openonyx.ui.internal.UiButton; +import openonyx.ui.internal.UiButtonMode; +import org.lwjgl.input.Mouse; + +public class CapeEditor extends GuiScreen { + private float G; + private boolean A; + private final GuiScreen guiScreen; + private double B; + private float C; + private float J; + private final CapeChanger capeChanger; + private double c; + private static final float a = 0.625F; + private final UiButton uiButton; + private static final float g = 8.0F; + private static final float M = 96.0F; + private final UiButton uiButton2; + private final UiButton uiButton3; + private final Render2D render2D; + private final UiButton uiButton4; + private static final float l = 1.12F; + private static final float I = 0.56F; + private final UiButton uiButton5; + private static final ResourceLocation RESOURCE_LOCATION = new ResourceLocation("onyx", "capes/source"); + private float f; + private float H; + private float e; + + @Override + protected void mouseClickMove(int i, int j, int k, long l) { + if (!this.A) { + super.mouseClickMove(i, j, k, lx); + } else { + this.capeChanger.offsetX.setValue(this.c + (i - this.e) / this.f * 100.0); + this.capeChanger.offsetY.setValue(this.B + (j - this.G) / this.H * 100.0); + } + } + + private UiButton[] L() { + UiButton[] uiButtons = new UiButton[5]; + boolean bl = true; + uiButtons[0] = this.uiButton5; + uiButtons[1] = this.uiButton; + uiButtons[2] = this.uiButton4; + uiButtons[3] = this.uiButton2; + uiButtons[4] = this.uiButton3; + return uiButtons; + } + + @Override + public void handleMouseInput() throws IOException { + CapeEditor capeEditor1 = this; + capeEditor1.handleMouseInput(); + int i; + if ((i = Mouse.getEventDWheel()) != 0 && capeEditor1.capeChanger.getBufferedImage() != null) { + double d = i > 0 ? 1.12F : 0.8928571390558262; + capeEditor1.capeChanger.zoom.setValue(capeEditor1.capeChanger.zoom.getValue() * d); + capeEditor1.capeChanger.l(); + } + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + public CapeEditor(GuiScreen guiScreen) { + this.capeChanger = OnyxClient.moduleManager.capeChanger; + this.render2D = new Render2D(); + this.uiButton5 = new UiButton(UiButtonMode.OUTLINED, "Fit", () -> this.L(FitMode.FIT)); + this.uiButton = new UiButton(UiButtonMode.OUTLINED, "Fill", () -> this.L(FitMode.FILL)); + this.uiButton4 = new UiButton(UiButtonMode.OUTLINED, "Stretch", () -> this.L(FitMode.STRETCH)); + this.uiButton2 = new UiButton(UiButtonMode.TONAL, "Reset", () -> { + this.capeChanger.zoom.reset(); + this.capeChanger.offsetX.reset(); + this.capeChanger.offsetY.reset(); + this.capeChanger.l(); + }); + this.uiButton3 = new UiButton(UiButtonMode.FILLED, "Done", () -> { + this.capeChanger.d(false); + this.mc.displayGuiScreen(this.guiScreen); + }); + this.guiScreen = guiScreenx; + } + + private void L(BufferedImage bufferedImage) { + this.render2D.rect(this.C, this.J, this.f, this.H, this.capeChanger.background.getValue() | 0xFF000000); + double[] d = ImageUtils.L( + bufferedImage, + ImageUtils.L(this.capeChanger.fit.getValue(), bufferedImage), + this.f, + this.H, + this.capeChanger.zoom.getValue() / 100.0, + this.capeChanger.offsetX.getValue() / 100.0, + this.capeChanger.offsetY.getValue() / 100.0 + ); + this.render2D.pushScissor(this.C, this.J, this.f, this.H); + this.render2D + .L( + RESOURCE_LOCATION, + this.C + (float)d[0], + this.J + (float)d[1], + (float)d[2], + (float)d[3], + 0.0F, + 0.0F, + bufferedImage.getWidth(), + bufferedImage.getHeight(), + bufferedImage.getWidth(), + bufferedImage.getHeight(), + -1, + TextureFilter.SMOOTH + ); + this.render2D.popScissor(); + this.render2D.roundedOutline(this.C, this.J, this.f, this.H, 8.0F, 1.5F, ThemeManager.getPalette().primary()); + this.render2D + .drawTextCentered( + Fonts.FONT_STYLE2, "top", this.width / 2.0F, this.J - 14.0F, ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.7F) + ); + String string = ImageUtils.L(this.capeChanger.fit.getValue(), bufferedImage).getDisplayName() + + " ยท " + + Math.round(this.capeChanger.zoom.getValue()) + + "%"; + this.render2D + .drawTextCentered( + Fonts.FONT_STYLE2, string, this.width / 2.0F, this.J + this.H + 8.0F, ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.85F) + ); + } + + @Override + protected void keyTyped(char c, int i) throws IOException { + if (i == 1) { + this.i(); + } else { + super.keyTyped(cx, i); + } + } + + @Override + public void drawScreen(int i, int j, float f) { + this.L(); + this.render2D.beginFrame(); + CapeEditor capeEditor1; + if (this.mc.theWorld != null) { + this.render2D.rect(0.0F, 0.0F, this.width, this.height, ThemeManager.scrim(0.7F)); + capeEditor1 = this; + } else { + this.render2D.L(0.0F, 0.0F, this.width, this.height); + capeEditor1 = this; + } + + capeEditor1.render2D.drawTextCentered(Fonts.FONT_STYLE14, "Cape", this.width / 2.0F, 22.0F, ThemeManager.getPalette().onSurface()); + this.render2D + .drawTextCentered( + Fonts.FONT_STYLE2, + "Drag to move, scroll to zoom", + this.width / 2.0F, + 44.0F, + ThemeManager.withAlpha(ThemeManager.getPalette().onSurfaceVariant(), 0.85F) + ); + BufferedImage bufferedImage; + if ((bufferedImage = this.capeChanger.getBufferedImage()) == null) { + this.render2D + .drawTextCentered( + Fonts.FONT_STYLE14, + "No cape picture loaded", + this.width / 2.0F, + this.height / 2.0F, + ThemeManager.withAlpha(ThemeManager.getPalette().onSurface(), 0.6F) + ); + } else { + this.L(bufferedImage); + } + + RenderContext renderContext = new RenderContext(this.render2D, 16.0F, i, j); + UiButton[] uiButtons; + int lx = (uiButtons = this.L()).length; + + int k; + for (int m = k = 0; m < lx; m = k) { + UiButton uiButtonx = uiButtons[k]; + k++; + uiButtonx.update(renderContext); + uiButtonx.render(renderContext); + } + + this.render2D.clearScissors(); + } + + @Override + protected void mouseClicked(int i, int j, int k) throws IOException { + UiButton[] uiButtons; + int lx = (uiButtons = this.L()).length; + + int m; + for (int n = m = 0; n < lx; n = ++m) { + if (uiButtons[m].mouseClicked(i, j, k)) { + return; + } + } + + if (k == 0 && this.capeChanger.getBufferedImage() != null && this.L(i, j)) { + this.A = true; + this.capeChanger.d(true); + this.e = i; + this.G = j; + this.c = this.capeChanger.offsetX.getValue(); + this.B = this.capeChanger.offsetY.getValue(); + } else { + super.mouseClicked(i, j, k); + } + } + + @Override + protected void mouseReleased(int i, int j, int k) { + CapeEditor capeEditor1 = this; + if (capeEditor1.A) { + capeEditor1.A = false; + capeEditor1.capeChanger.d(false); + } + + UiButton[] uiButtons; + int lx = (uiButtons = capeEditor1.L()).length; + + for (int n = m = 0; n < lx; n = m) { + UiButton uiButtonx = uiButtons[m]; + float fx = i; + m++; + uiButtonx.mouseReleased(fx, j, k); + } + + capeEditor1.mouseReleased(i, j, k); + } + + private void L() { + CapeEditor capeEditor1 = this; + capeEditor1.H = capeEditor1.height * 0.56F; + capeEditor1.f = capeEditor1.H * 0.625F; + capeEditor1.C = capeEditor1.width / 2.0F - capeEditor1.f / 2.0F; + capeEditor1.J = capeEditor1.height / 2.0F - capeEditor1.H / 2.0F - 8.0F; + float gx = 512.0F; + float h = capeEditor1.width / 2.0F - gx / 2.0F; + float fx = capeEditor1.height - 46.0F; + capeEditor1.uiButton5.setBounds(h, fx, 96.0F, 30.0F); + capeEditor1.uiButton.setBounds(h + 96.0F + 8.0F, fx, 96.0F, 30.0F); + capeEditor1.uiButton4.setBounds(h + 208.0F, fx, 96.0F, 30.0F); + capeEditor1.uiButton2.setBounds(h + 312.0F, fx, 96.0F, 30.0F); + capeEditor1.uiButton3.setBounds(h + 416.0F, fx, 96.0F, 30.0F); + } + + private void L(FitMode fitMode) { + this.capeChanger.fit.setValue(fitMode); + } + + private boolean L(float f, float g) { + return fx >= this.C && fx <= this.C + this.f && gx >= this.J && gx <= this.J + this.H; + } +} diff --git a/src/openonyx/ui/ClickGuiScreen.java b/src/openonyx/ui/ClickGuiScreen.java new file mode 100644 index 0000000..7f2402a --- /dev/null +++ b/src/openonyx/ui/ClickGuiScreen.java @@ -0,0 +1,230 @@ +package openonyx.ui; + +import java.io.IOException; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import openonyx.features.Module; +import openonyx.history.UndoManager; +import openonyx.input.CharInput; +import openonyx.input.KeyInput; +import openonyx.render.BoxBlurShader; +import openonyx.render.Render2D; +import openonyx.render.RenderSupport_120; +import openonyx.render.group_d.Animation; +import openonyx.render.group_d.Easings; +import openonyx.theme.ThemeManager; +import openonyx.ui.internal.TextInput; +import org.lwjgl.input.Mouse; + +public class ClickGuiScreen extends GuiScreen { + private float J; + private static final float D = 100.0F; + private final GuiScreen guiScreen; + private float a; + private final Render2D render2D; + private float g; + private final Animation animation; + private long L; + private static final float j = 0.62F; + private final ClickGuiWindow clickGuiWindow = new ClickGuiWindow(); + private final Animation animation2; + private static final int l = 120; + private final Module module; + private boolean d; + private static final float i = 0.72F; + private static final float f = 16.0F; + private float H; + private boolean e; + + private void D() { + ClickGuiScreen clickGuiScreen1 = this; + int ix = new ScaledResolution(clickGuiScreen1.mc).getScaleFactor(); + clickGuiScreen1.H = clickGuiScreen1.L((float)Minecraft.getScaledMouseX() / ix); + clickGuiScreen1.J = clickGuiScreen1.L((float)(clickGuiScreen1.mc.displayHeight - Minecraft.getScaledMouseY()) / ix); + } + + @Override + protected void mouseClicked(int i, int j, int k) throws IOException { + this.D(); + if (!this.clickGuiWindow.mouseClicked(this.H, this.J, k)) { + super.mouseClicked(ix, jx, k); + } + } + + @Override + public void drawScreen(int i, int j, float h) { + if (this.d()) { + this.L(); + } else { + float fx = this.L(); + this.animation.update(fx); + this.animation2.update(fx); + if (this.g != ThemeManager.getUiScale()) { + this.d(); + } + + this.D(); + this.render2D.beginFrame(); + if (this.mc.theWorld == null) { + this.render2D.L(0.0F, 0.0F, this.width, this.height); + this.render2D.clearScissors(); + BoxBlurShader.d(); + BoxBlurShader.l(); + this.render2D.beginFrame(); + } else { + RenderSupport_120.d(); + this.render2D.rect(0.0F, 0.0F, this.width, this.height, ThemeManager.scrim(0.32F * this.animation2.getValue())); + } + + RenderContext renderContext = new RenderContext(this.render2D, fx, this.H, this.J); + float gx = this.animation.getValue(); + this.render2D.pushMatrix(); + this.render2D.transforms().L(this.a, this.a); + this.render2D.scaleAround(0.92F + 0.08F * gx, this.clickGuiWindow.j(), this.clickGuiWindow.e()); + this.clickGuiWindow.L(gx); + this.clickGuiWindow.update(renderContext); + this.clickGuiWindow.render(renderContext); + this.render2D.popMatrix(); + this.render2D.clearScissors(); + } + } + + private void d() { + ClickGuiScreen clickGuiScreen1 = this; + float fx = Math.min( + clickGuiScreen1.width * 0.62F / clickGuiScreen1.clickGuiWindow.i(), clickGuiScreen1.height * 0.72F / clickGuiScreen1.clickGuiWindow.L() + ); + clickGuiScreen1.a = Math.min(ThemeManager.getUiScale(), fx); + clickGuiScreen1.g = ThemeManager.getUiScale(); + clickGuiScreen1.clickGuiWindow.L(clickGuiScreen1.width / clickGuiScreen1.a, clickGuiScreen1.height / clickGuiScreen1.a); + } + + @Override + public void initGui() { + if (!this.e) { + this.e = true; + UndoManager.L(); + this.animation.set(0.0F).animateTo(1.0F, 400.0F, Easings.EASING7); + this.animation2.set(0.0F).animateTo(1.0F, 250.0F, Easings.EASING5); + } + + this.L = 0L; + this.d = this.L(); + this.d(); + } + + public ClickGuiScreen(Module module, GuiScreen guiScreen) { + this.render2D = new Render2D(); + this.animation = new Animation(0.0F); + this.animation2 = new Animation(0.0F); + this.a = 1.0F; + this.module = modulex; + this.guiScreen = guiScreenx; + } + + @Override + public void onGuiClosed() { + UndoManager.d(); + if (this.module != null && this.module.isEnabled()) { + this.module.toggle(); + } + } + + private boolean d() { + ClickGuiScreen clickGuiScreen1 = this; + boolean bl; + if ((bl = clickGuiScreen1.L()) == clickGuiScreen1.d) { + return false; + } + + clickGuiScreen1.d = bl; + return bl && !TextInput.h(); + } + + private float L() { + long lx = System.nanoTime(); + if (this.L == 0L) { + this.L = lx; + return 16.0F; + } else { + float fx = (float)(lx - this.L) / 1000000.0F; + this.L = lx; + return Math.min(fx, 100.0F); + } + } + + @Override + protected void mouseReleased(int i, int j, int k) { + this.D(); + if (!this.clickGuiWindow.mouseReleased(this.H, this.J, k)) { + super.mouseReleased(ix, jx, k); + } + } + + @Override + protected void mouseClickMove(int i, int j, int k, long l) { + ClickGuiScreen clickGuiScreen1 = this; + float fx = clickGuiScreen1.H; + float gx = clickGuiScreen1.J; + clickGuiScreen1.D(); + if (!clickGuiScreen1.clickGuiWindow.mouseDragged(clickGuiScreen1.H, clickGuiScreen1.J, k, clickGuiScreen1.H - fx, clickGuiScreen1.J - gx)) { + clickGuiScreen1.mouseClickMove(ix, jx, k, lx); + } + } + + private boolean L() { + return this.module != null && this.module.getBind().isBound() ? this.module.getBind().isPressed() : false; + } + + private void L() { + this.mc.displayGuiScreen(this.guiScreen); + } + + @Override + public void handleMouseInput() throws IOException { + ClickGuiScreen clickGuiScreen1 = this; + int ix; + if ((ix = Mouse.getEventDWheel()) != 0) { + clickGuiScreen1.D(); + if (clickGuiScreen1.clickGuiWindow.mouseScrolled(clickGuiScreen1.H, clickGuiScreen1.J, ix / 120.0)) { + return; + } + } + + clickGuiScreen1.handleMouseInput(); + } + + @Override + public void setWorldAndResolution(Minecraft minecraft, int i, int j) { + super.setWorldAndResolution(minecraft, ix, jx); + this.d(); + } + + @Override + protected void keyTyped(char c, int i) throws IOException { + KeyInput keyInput = new KeyInput(ix, 0, 0, c); + if (!this.clickGuiWindow.keyTyped(keyInput)) { + if (ix != 1 || !this.clickGuiWindow.I()) { + if (this.module == null || !this.module.getBind().matchesKey(ix) || TextInput.h()) { + if (c < ' ' || !this.clickGuiWindow.charTyped(new CharInput(c, 0))) { + if (ix == 1) { + this.L(); + } else { + super.keyTyped(c, ix); + } + } + } + } + } + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + private float L(double d) { + return (float)(dx / this.a); + } +} diff --git a/src/openonyx/ui/ClickGuiWindow.java b/src/openonyx/ui/ClickGuiWindow.java new file mode 100644 index 0000000..0917070 --- /dev/null +++ b/src/openonyx/ui/ClickGuiWindow.java @@ -0,0 +1,527 @@ +package openonyx.ui; + +import openonyx.core.OnyxClient; +import openonyx.features.Module; +import openonyx.features.ModuleCategory; +import openonyx.history.UndoManager; +import openonyx.input.CharInput; +import openonyx.input.KeyInput; +import openonyx.misc.ConfigManager; +import openonyx.render.Render2D; +import openonyx.render.RenderSupport_120; +import openonyx.render.group_d.Animation; +import openonyx.render.group_d.Easings; +import openonyx.render.group_e.FontStyle; +import openonyx.theme.AlphaLevels; +import openonyx.theme.Fonts; +import openonyx.theme.ThemeManager; +import openonyx.ui.internal.ConfigsPanel; +import openonyx.ui.internal.ModuleList; +import openonyx.ui.internal.ModuleSearch; +import openonyx.ui.internal.ModuleSettingsPanel; +import openonyx.ui.internal.Sidebar; +import openonyx.ui.internal.UiSupport_571; + +public class ClickGuiWindow extends UiComponent { + private static final float p = 36.0F; + private static final float t = 640.0F; + private float b; + private float E; + private float F; + private final ModuleSearch moduleSearch; + private static final String A = "onyx client"; + private final ConfigsPanel configsPanel; + private final Animation animation; + private boolean C; + private final UiSupport_545 uiSupport_545; + private static float D; + private static final float c = 420.0F; + private float a; + private static final float k = 96.0F; + private final Sidebar sidebar; + private float M; + private float L; + private static float j; + private boolean m; + private static ModuleCategory moduleCategory = ModuleCategory.COMBAT; + private boolean l; + private float I; + private final ModuleSettingsPanel moduleSettingsPanel = new ModuleSettingsPanel(); + private final ModuleList moduleList; + private final UiSupport_571 uiSupport_571; + + private boolean D(KeyInput keyInput) { + if (KeyShortcuts.i(keyInput)) { + this.d(); + return true; + } else if (KeyShortcuts.D(keyInput)) { + this.uiSupport_571.L(UndoManager.d() ? "Undone" : "Nothing to undo"); + return true; + } else if (KeyShortcuts.L(keyInput)) { + this.uiSupport_571.L(UndoManager.L() ? "Redone" : "Nothing to redo"); + return true; + } else { + return false; + } + } + + @Override + public boolean mouseClicked(float f, float g, int i) { + if (i == 0 && this.d(f, g)) { + this.I(); + return true; + } + + if (this.l) { + if (this.C) { + if (this.configsPanel.mouseClicked(f, g, i)) { + return true; + } + } else if (this.moduleSettingsPanel.mouseClicked(f, g, i)) { + return true; + } + + if (i == 1 && this.contains(f, g)) { + this.I(); + return true; + } + } else { + if (this.moduleSearch.mouseClicked(f, g, i)) { + return true; + } + + if (this.sidebar.mouseClicked(f, g, i)) { + return true; + } + + if (this.moduleList.mouseClicked(f, g, i)) { + return true; + } + } + + if (i == 0 && f >= this.f && f < this.f + this.e && g >= this.d && g < this.d + F()) { + this.m = true; + this.E = f - this.f; + this.I = g - this.d; + return true; + } else { + return this.contains(f, g); + } + } + + private float B() { + return this.d + F() / 2.0F; + } + + public float j() { + return this.f + this.e / 2.0F; + } + + @Override + public void render(RenderContext renderContext) { + ClickGuiWindow clickGuiWindow1 = this; + Render2D render2D = renderContext.render2D; + render2D.pushAlpha(clickGuiWindow1.F); + render2D.shadow(clickGuiWindow1.f, clickGuiWindow1.d, clickGuiWindow1.e, clickGuiWindow1.i, 28.0F, 3); + RenderSupport_120.L( + render2D, clickGuiWindow1.f, clickGuiWindow1.d, clickGuiWindow1.e, clickGuiWindow1.i, 28.0F, AlphaLevels.L(2, renderContext.palette()) + ); + render2D.popAlpha(); + float f; + clickGuiWindow1.L(renderContext, f = clickGuiWindow1.animation.getValue()); + if (f < 0.999F) { + render2D.pushAlpha(clickGuiWindow1.F * (1.0F - f)); + render2D.pushMatrix(); + render2D.translate(-36.0F * f, 0.0F); + clickGuiWindow1.sidebar.render(renderContext); + clickGuiWindow1.moduleList.render(renderContext); + render2D.popMatrix(); + render2D.popAlpha(); + } + + if (f > 0.001F) { + render2D.pushAlpha(clickGuiWindow1.F * f); + render2D.pushMatrix(); + render2D.translate(36.0F * (1.0F - f), 0.0F); + Render2D render2D1; + if (clickGuiWindow1.C) { + clickGuiWindow1.configsPanel.render(renderContext); + render2D1 = render2D; + } else { + clickGuiWindow1.moduleSettingsPanel.render(renderContext); + render2D1 = render2D; + } + + render2D1.popMatrix(); + render2D.popAlpha(); + } + + clickGuiWindow1.uiSupport_571.render(renderContext); + } + + private String L() { + ClickGuiWindow clickGuiWindow1 = this; + if (!clickGuiWindow1.moduleList.i()) { + return clickGuiWindow1.sidebar.getModuleCategory().d(); + } + + int i; + return (i = clickGuiWindow1.moduleList.i()) == 1 ? "1 result" : i + " results"; + } + + @Override + public boolean mouseDragged(float f, float g, int i, float h, float j) { + if (this.m) { + this.d(f - this.E, g - this.I); + return true; + } else if (!this.l) { + return this.moduleSearch.mouseDragged(f, g, i, h, jx); + } else { + return this.C ? this.configsPanel.mouseDragged(f, g, i, h, jx) : this.moduleSettingsPanel.mouseDragged(f, g, i, h, jx); + } + } + + @Override + public boolean mouseReleased(float f, float g, int i) { + this.m = false; + if (this.l) { + return this.C ? this.configsPanel.mouseReleased(f, g, i) : this.moduleSettingsPanel.mouseReleased(f, g, i); + } else { + return this.moduleList.mouseReleased(f, g, i); + } + } + + private static float A() { + return 10.0F; + } + + private boolean d(KeyInput keyInput) { + switch (keyInput.key()) { + case 200: + while (false) { + } + + return this.moduleList.L(0, -1); + case 201: + case 202: + case 204: + case 206: + case 207: + default: + return false; + case 203: + if (!this.moduleSearch.i() && this.moduleList.L(-1, 0)) { + return true; + } + + return false; + case 205: + if (!this.moduleSearch.i() && this.moduleList.L(1, 0)) { + return true; + } + + return false; + case 208: + return this.moduleList.L(0, 1); + } + } + + private static float H() { + return 62.0F; + } + + @Override + public boolean charTyped(CharInput charInput) { + if (this.l) { + return this.C ? this.configsPanel.charTyped(charInput) : this.moduleSettingsPanel.charTyped(charInput); + } else if (this.moduleSearch.i()) { + return this.moduleSearch.charTyped(charInput); + } else { + return KeyShortcuts.L(charInput) && !Character.isWhitespace(charInput.codepoint()) ? this.moduleSearch.d(charInput) : false; + } + } + + public boolean l() { + return this.l; + } + + @Override + protected void L() { + ClickGuiWindow clickGuiWindow1 = this; + float f = clickGuiWindow1.d + F(); + float g = clickGuiWindow1.i - F() - A(); + clickGuiWindow1.sidebar.setBounds(clickGuiWindow1.f + A(), f, H(), g); + clickGuiWindow1.moduleSettingsPanel.setBounds(clickGuiWindow1.f + A(), f, clickGuiWindow1.e - A() * 2.0F, g); + clickGuiWindow1.configsPanel.setBounds(clickGuiWindow1.f + A(), f, clickGuiWindow1.e - A() * 2.0F, g); + clickGuiWindow1.uiSupport_571.setBounds(clickGuiWindow1.f, clickGuiWindow1.d, clickGuiWindow1.e, clickGuiWindow1.i); + } + + private void d(float f, float g) { + this.setBounds(Math.round(Math.clamp(f, 96.0F - this.e, this.M - 96.0F)), Math.round(Math.clamp(g, 0.0F, this.b - F())), this.e, this.i); + j = this.f - this.L; + D = this.d - this.a; + } + + private boolean d(float f, float g) { + return this.l && f >= this.I() && f < this.I() + l() && g >= this.k() && g < this.k() + l(); + } + + public float e() { + return this.d + this.i / 2.0F; + } + + public void L(Module module) { + this.moduleSearch.D(false); + this.moduleSettingsPanel.L(module); + this.C = false; + this.l = true; + this.animation.animateTo(1.0F, 300.0F, Easings.EASING2); + } + + private void L(RenderContext renderContext, float f) { + Render2D render2D = renderContext.render2D; + if (f < 0.999F) { + float g; + float h = g = this.F * (1.0F - f); + render2D.drawTextVCentered( + Fonts.getFontstylE18(), "onyx client", this.f + A() + 6.0F, this.B(), ThemeManager.withAlpha(renderContext.palette().onSurface(), g) + ); + render2D.drawTextRightVCentered( + Fonts.getFontstylE2(), this.L(), this.f + this.e - A() - 6.0F, this.B(), ThemeManager.withAlpha(renderContext.palette().onSurfaceVariant(), g) + ); + render2D.pushAlpha(h); + this.moduleSearch.render(renderContext); + render2D.popAlpha(); + } + + Module module = this.moduleSettingsPanel.getModule(); + if (f > 0.001F && (this.C || module != null)) { + f = this.F * f; + this.uiSupport_545.L(render2D, this.I(), this.k(), l(), l(), Float.MAX_VALUE, renderContext.palette().onSurface()); + MaterialIcons.I(render2D, this.I() + l() / 2.0F, this.k() + l() / 2.0F, 15.0F, ThemeManager.withAlpha(renderContext.palette().onSurface(), f)); + FontStyle fontStyle = Fonts.getFontstylE18(); + ClickGuiWindow clickGuiWindow1; + String string; + if (this.C) { + string = "Configs"; + clickGuiWindow1 = this; + } else { + string = module.getName(); + clickGuiWindow1 = this; + } + + render2D.drawTextVCentered( + fontStyle, string, clickGuiWindow1.I() + l() + 8.0F, this.B(), ThemeManager.withAlpha(renderContext.palette().onSurface(), f) + ); + fontStyle = Fonts.getFontstylE2(); + if (this.C) { + string = this.configsPanel.L(); + clickGuiWindow1 = this; + } else { + string = module.getModuleCategory().d(); + clickGuiWindow1 = this; + } + + render2D.drawTextRightVCentered( + fontStyle, string, clickGuiWindow1.f + this.e - A() - 6.0F, this.B(), ThemeManager.withAlpha(renderContext.palette().onSurfaceVariant(), f) + ); + } + } + + private float k() { + return this.B() - l() / 2.0F; + } + + private void D(RenderContext renderContext) { + Render2D render2D = renderContext.render2D; + float h = this.f + A() + 6.0F + render2D.getTextWidth(Fonts.getFontstylE18(), "onyx client"); + float i = Math.max(this.f + A() + H() + A(), h + h()); + float f = render2D.getTextWidth(Fonts.getFontstylE2(), this.L()); + float g = this.d + F(); + f = this.f + this.e - A() - 6.0F - f - h(); + this.moduleSearch.setBounds(i, this.B() - ModuleSearch.k() / 2.0F, f - i, ModuleSearch.k()); + this.moduleList.setBounds(i, g, this.f + this.e - A() - i, this.i - F() - A()); + } + + private boolean h() { + ClickGuiWindow clickGuiWindow1 = this; + Module module; + if ((module = clickGuiWindow1.moduleList.L()) == null) { + return false; + } + + clickGuiWindow1.L(module); + return true; + } + + public boolean I() { + if (!this.l) { + return false; + } + + if (this.C) { + this.configsPanel.D(); + } + + this.l = false; + this.animation.animateTo(0.0F, 300.0F, Easings.EASING2); + return true; + } + + public void D() { + this.moduleSearch.D(false); + this.configsPanel.i(); + this.C = true; + this.l = true; + this.animation.animateTo(1.0F, 300.0F, Easings.EASING2); + } + + public void L(float f, float g) { + this.M = f; + this.b = g; + this.L = (f - this.e) / 2.0F; + this.a = (g - this.i) / 2.0F; + this.d(this.L + j, this.a + D); + } + + private static float F() { + return 38.0F; + } + + @Override + public void update(RenderContext renderContext) { + this.D(renderContext); + this.animation.update(renderContext.i); + this.uiSupport_545.L(renderContext.i, this.d(renderContext.H, renderContext.f), false); + this.h = this.contains(renderContext.H, renderContext.f); + float f; + if ((f = this.animation.getValue()) < 0.999F) { + this.sidebar.update(renderContext); + this.moduleSearch.update(renderContext); + this.moduleList.update(renderContext); + } + + ClickGuiWindow clickGuiWindow1; + label17: { + if (f > 0.001F) { + if (this.C) { + this.configsPanel.update(renderContext); + clickGuiWindow1 = this; + break label17; + } + + this.moduleSettingsPanel.update(renderContext); + } + + clickGuiWindow1 = this; + } + + clickGuiWindow1.uiSupport_571.update(renderContext); + } + + public ClickGuiWindow() { + this.configsPanel = new ConfigsPanel(); + this.moduleSearch = new ModuleSearch(string -> this.moduleList.L(string)); + this.uiSupport_571 = new UiSupport_571(); + this.uiSupport_545 = new UiSupport_545(); + this.animation = new Animation(0.0F); + this.F = 1.0F; + this.e = 640.0F; + this.i = 420.0F; + this.moduleList = new ModuleList(moduleCategory, this::L); + this.sidebar = new Sidebar(moduleCategory, moduleCategory -> { + moduleCategory = moduleCategoryx; + this.moduleSearch.l(); + this.moduleList.L(moduleCategoryx); + }, this::D); + this.uiComponents.add(this.sidebar); + this.uiComponents.add(this.moduleSearch); + this.uiComponents.add(this.moduleList); + this.uiComponents.add(this.moduleSettingsPanel); + this.uiComponents.add(this.configsPanel); + } + + private boolean i() { + ClickGuiWindow clickGuiWindow1 = this; + Module module; + if ((module = clickGuiWindow1.moduleList.L()) == null) { + return false; + } + + module.toggle(); + return true; + } + + private void d() { + ClickGuiWindow clickGuiWindow1 = this; + ConfigManager configManager = OnyxClient.configManager; + String string = OnyxClient.configManager.d(); + UiSupport_571 uiSupport_571x = clickGuiWindow1.uiSupport_571; + boolean bl = configManager.F(string); + StringBuilder stringBuilder = new StringBuilder; + String string1; + if (bl) { + stringBuilder./* $VF: Unable to resugar constructor */(); + string1 = stringBuilder.insert(0, "Saved ").append(string).toString(); + } else { + stringBuilder./* $VF: Unable to resugar constructor */(); + string1 = stringBuilder.insert(0, "Could not save ").append(string).toString(); + } + + uiSupport_571x.L(string1); + } + + private static float l() { + return 26.0F; + } + + public void L(float f) { + this.F = f; + } + + @Override + public boolean mouseScrolled(float f, float g, double d) { + if (this.l) { + return this.C ? this.configsPanel.mouseScrolled(f, g, d) : this.moduleSettingsPanel.mouseScrolled(f, g, d); + } else { + return this.moduleList.mouseScrolled(f, g, d); + } + } + + @Override + public boolean keyTyped(KeyInput keyInput) { + if (!this.l) { + if (KeyShortcuts.I(keyInput)) { + this.moduleSearch.D(true); + this.moduleSearch.d(); + return true; + } else if (this.D(keyInput)) { + return true; + } else if (this.d(keyInput)) { + return true; + } else if (KeyShortcuts.d(keyInput) && this.h()) { + return true; + } else if (this.moduleSearch.keyTyped(keyInput)) { + return true; + } else { + return keyInput.key() == 57 && this.i() ? true : KeyShortcuts.l(keyInput) && !this.moduleSearch.i(); + } + } else if (this.C ? !this.configsPanel.keyTyped(keyInput) : !this.moduleSettingsPanel.keyTyped(keyInput)) { + if (this.D(keyInput)) { + return true; + } else { + return KeyShortcuts.l(keyInput) ? this.I() : false; + } + } else { + return true; + } + } + + private static float h() { + return 12.0F; + } + + private float I() { + return this.f + A(); + } +}