performance + theme update

we been rendering the hud twice this entire time lmfao
This commit is contained in:
0x150 2022-01-07 10:57:00 +01:00
parent af5292a4b4
commit 45713942a9
3 changed files with 56 additions and 49 deletions

View file

@ -11,33 +11,40 @@ public class SipoverV1 implements Theme {
return "Sipover V1"; 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 @Override
public Color getAccent() { public Color getAccent() {
return new Color(0xc7f4ff); return accent;
} }
@Override @Override
public Color getHeader() { public Color getHeader() {
return new Color(0xFF1D2525, true); return header;
} }
@Override @Override
public Color getModule() { public Color getModule() {
return new Color(0xFF171E1F, true); return module;
} }
@Override @Override
public Color getConfig() { public Color getConfig() {
return new Color(0xFF111A1A, true); return config;
} }
@Override @Override
public Color getActive() { public Color getActive() {
return new Color(200, 200, 225, 255); return active;
} }
@Override @Override
public Color getInactive() { public Color getInactive() {
return new Color(80, 80, 80, 255); return inactive;
} }
} }

View file

@ -36,7 +36,6 @@ import java.net.http.HttpRequest;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
@ -87,6 +86,7 @@ public class HomeScreen extends AntiAliasedScreen implements FastTickable {
public void resize(MinecraftClient client, int width, int height) { public void resize(MinecraftClient client, int width, int height) {
this.width = width; this.width = width;
this.height = height; this.height = height;
clearChildren();
initWidgets(); initWidgets();
} }

View file

@ -143,48 +143,48 @@ public class Hud extends Module {
@Override @Override
public void onHudRender() { public void onHudRender() {
if (CoffeeClientMain.client.getNetworkHandler() == null) { // if (CoffeeClientMain.client.getNetworkHandler() == null) {
return; // return;
} // }
if (CoffeeClientMain.client.player == null) { // if (CoffeeClientMain.client.player == null) {
return; // return;
} // }
MatrixStack ms = Renderer.R3D.getEmptyMatrixStack(); // MatrixStack ms = Renderer.R3D.getEmptyMatrixStack();
double heightOffsetLeft = 0, heightOffsetRight = 0; // double heightOffsetLeft = 0, heightOffsetRight = 0;
if (CoffeeClientMain.client.options.debugEnabled) { // if (CoffeeClientMain.client.options.debugEnabled) {
double heightAccordingToMc = 9; // double heightAccordingToMc = 9;
List<String> lt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetLeftText(); // List<String> lt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetLeftText();
List<String> rt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetRightText(); // List<String> rt = ((IDebugHudAccessor) ((IInGameHudAccessor) CoffeeClientMain.client.inGameHud).getDebugHud()).callGetRightText();
heightOffsetLeft = 2 + heightAccordingToMc * (lt.size() + 3); // heightOffsetLeft = 2 + heightAccordingToMc * (lt.size() + 3);
heightOffsetRight = 2 + heightAccordingToMc * rt.size() + 5; // heightOffsetRight = 2 + heightAccordingToMc * rt.size() + 5;
} // }
if (!shouldNoConnectionDropDown()) { // if (!shouldNoConnectionDropDown()) {
if (serverNotResponding != null) { // if (serverNotResponding != null) {
serverNotResponding.duration = 0; // serverNotResponding.duration = 0;
} // }
} else { // } else {
if (serverNotResponding == null) { // if (serverNotResponding == null) {
serverNotResponding = Notification.create(-1, "", true, "Server not responding! " + minSec.format(System.currentTimeMillis() - lastTimePacketReceived)); // 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)}; // serverNotResponding.contents = new String[]{"Server not responding! " + minSec.format(System.currentTimeMillis() - lastTimePacketReceived)};
} // }
if (!NotificationRenderer.topBarNotifications.contains(serverNotResponding)) { // if (!NotificationRenderer.topBarNotifications.contains(serverNotResponding)) {
serverNotResponding = null; // serverNotResponding = null;
} // }
makeSureIsInitialized(); // makeSureIsInitialized();
//
if (modules.getValue()) { // if (modules.getValue()) {
ms.push(); // ms.push();
ms.translate(0, heightOffsetRight, 0); // ms.translate(0, heightOffsetRight, 0);
drawModuleList(ms); // drawModuleList(ms);
ms.pop(); // ms.pop();
} // }
ms.push(); // ms.push();
ms.translate(0, heightOffsetLeft, 0); // ms.translate(0, heightOffsetLeft, 0);
drawTopLeft(ms); // drawTopLeft(ms);
ms.pop(); // ms.pop();
//
HudRenderer.getInstance().render(); // HudRenderer.getInstance().render();
} }
void drawTopLeft(MatrixStack ms) { void drawTopLeft(MatrixStack ms) {