From 45713942a9da679499b9aa7657204e605c37fe46 Mon Sep 17 00:00:00 2001 From: 0x150 Date: Fri, 7 Jan 2022 10:57:00 +0100 Subject: [PATCH] performance + theme update we been rendering the hud twice this entire time lmfao --- .../gui/clickgui/theme/impl/SipoverV1.java | 19 +++-- .../feature/gui/screen/HomeScreen.java | 2 +- .../feature/module/impl/render/Hud.java | 84 +++++++++---------- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/src/main/java/me/x150/sipprivate/feature/gui/clickgui/theme/impl/SipoverV1.java b/src/main/java/me/x150/sipprivate/feature/gui/clickgui/theme/impl/SipoverV1.java index 9a7e818..5a0b09a 100644 --- a/src/main/java/me/x150/sipprivate/feature/gui/clickgui/theme/impl/SipoverV1.java +++ b/src/main/java/me/x150/sipprivate/feature/gui/clickgui/theme/impl/SipoverV1.java @@ -11,33 +11,40 @@ public class SipoverV1 implements Theme { return "Sipover V1"; } + static Color accent = new Color(0x3AD99D), + header = new Color(0xFF1D2525, true), + module = new Color(0xFF171E1F, true), + config = new Color(0xFF111A1A, true), + active = new Color(21, 157, 204, 255), + inactive = new Color(66, 66, 66, 255); + @Override public Color getAccent() { - return new Color(0xc7f4ff); + return accent; } @Override public Color getHeader() { - return new Color(0xFF1D2525, true); + return header; } @Override public Color getModule() { - return new Color(0xFF171E1F, true); + return module; } @Override public Color getConfig() { - return new Color(0xFF111A1A, true); + return config; } @Override public Color getActive() { - return new Color(200, 200, 225, 255); + return active; } @Override public Color getInactive() { - return new Color(80, 80, 80, 255); + return inactive; } } diff --git a/src/main/java/me/x150/sipprivate/feature/gui/screen/HomeScreen.java b/src/main/java/me/x150/sipprivate/feature/gui/screen/HomeScreen.java index d0f33ac..6c82e94 100644 --- a/src/main/java/me/x150/sipprivate/feature/gui/screen/HomeScreen.java +++ b/src/main/java/me/x150/sipprivate/feature/gui/screen/HomeScreen.java @@ -36,7 +36,6 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.nio.file.Files; import java.util.Objects; import java.util.UUID; @@ -87,6 +86,7 @@ public class HomeScreen extends AntiAliasedScreen implements FastTickable { public void resize(MinecraftClient client, int width, int height) { this.width = width; this.height = height; + clearChildren(); initWidgets(); } diff --git a/src/main/java/me/x150/sipprivate/feature/module/impl/render/Hud.java b/src/main/java/me/x150/sipprivate/feature/module/impl/render/Hud.java index 0ffe842..6db8519 100644 --- a/src/main/java/me/x150/sipprivate/feature/module/impl/render/Hud.java +++ b/src/main/java/me/x150/sipprivate/feature/module/impl/render/Hud.java @@ -143,48 +143,48 @@ public class Hud extends Module { @Override public void onHudRender() { - if (CoffeeClientMain.client.getNetworkHandler() == null) { - return; - } - if (CoffeeClientMain.client.player == null) { - return; - } - MatrixStack ms = Renderer.R3D.getEmptyMatrixStack(); - double heightOffsetLeft = 0, heightOffsetRight = 0; - if (CoffeeClientMain.client.options.debugEnabled) { - double heightAccordingToMc = 9; - List lt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetLeftText(); - List rt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetRightText(); - heightOffsetLeft = 2 + heightAccordingToMc * (lt.size() + 3); - heightOffsetRight = 2 + heightAccordingToMc * rt.size() + 5; - } - if (!shouldNoConnectionDropDown()) { - if (serverNotResponding != null) { - serverNotResponding.duration = 0; - } - } else { - if (serverNotResponding == null) { - serverNotResponding = Notification.create(-1, "", true, "Server not responding! " + minSec.format(System.currentTimeMillis() - lastTimePacketReceived)); - } - serverNotResponding.contents = new String[]{"Server not responding! " + minSec.format(System.currentTimeMillis() - lastTimePacketReceived)}; - } - if (!NotificationRenderer.topBarNotifications.contains(serverNotResponding)) { - serverNotResponding = null; - } - makeSureIsInitialized(); - - if (modules.getValue()) { - ms.push(); - ms.translate(0, heightOffsetRight, 0); - drawModuleList(ms); - ms.pop(); - } - ms.push(); - ms.translate(0, heightOffsetLeft, 0); - drawTopLeft(ms); - ms.pop(); - - HudRenderer.getInstance().render(); +// if (CoffeeClientMain.client.getNetworkHandler() == null) { +// return; +// } +// if (CoffeeClientMain.client.player == null) { +// return; +// } +// MatrixStack ms = Renderer.R3D.getEmptyMatrixStack(); +// double heightOffsetLeft = 0, heightOffsetRight = 0; +// if (CoffeeClientMain.client.options.debugEnabled) { +// double heightAccordingToMc = 9; +// List lt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetLeftText(); +// List rt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetRightText(); +// heightOffsetLeft = 2 + heightAccordingToMc * (lt.size() + 3); +// heightOffsetRight = 2 + heightAccordingToMc * rt.size() + 5; +// } +// if (!shouldNoConnectionDropDown()) { +// if (serverNotResponding != null) { +// serverNotResponding.duration = 0; +// } +// } else { +// if (serverNotResponding == null) { +// serverNotResponding = Notification.create(-1, "", true, "Server not responding! " + minSec.format(System.currentTimeMillis() - lastTimePacketReceived)); +// } +// serverNotResponding.contents = new String[]{"Server not responding! " + minSec.format(System.currentTimeMillis() - lastTimePacketReceived)}; +// } +// if (!NotificationRenderer.topBarNotifications.contains(serverNotResponding)) { +// serverNotResponding = null; +// } +// makeSureIsInitialized(); +// +// if (modules.getValue()) { +// ms.push(); +// ms.translate(0, heightOffsetRight, 0); +// drawModuleList(ms); +// ms.pop(); +// } +// ms.push(); +// ms.translate(0, heightOffsetLeft, 0); +// drawTopLeft(ms); +// ms.pop(); +// +// HudRenderer.getInstance().render(); } void drawTopLeft(MatrixStack ms) {