From fc95f56fc80f38e818c9c6377a415c6b17775685 Mon Sep 17 00:00:00 2001 From: Shirona1337 Date: Fri, 22 May 2026 00:38:41 +0800 Subject: [PATCH] fix(gui): wrap PanelClickGui body in Renderer.render so search stays aligned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous attempt only made Renderer.render share GuiGraphics.pose() with DrawContext when guiGraphics was non-null. But every sub-panel call (drawSearchBar, drawToasts, ModuleListPanel, SettingsPanel, CategoryBar, ProfileWidget, SettingsPopup, KeybindOverlay, ScaleSwitchOverlay) used Renderer.renderConsumer, which falls back to Renderer.render(null, ...) when currentCanvas == null — that's exactly the Screen.render path. With guiGraphics == null the DrawContext still got a private new PoseStack(), so any element rendered through DrawContext was identity-posed while the search background drawn via guiGraphics.pose() rode along with pushPose + scale(0.98+0.02*eased), and the two drifted apart. Wrap the entire PanelClickGui body inside Renderer.render( guiGraphics, ...). That sets currentCanvas to a DrawContext whose PoseStack is GuiGraphics.pose(), so every nested renderConsumer short-circuits into the same DrawContext and shares the same matrix. Search icon, placeholder, query text and the blinking cursor now sit on the same scaled pose as the search background. Toasts get the fix for free. Co-Authored-By: Claude Opus 4.7 --- src/main/java/shit/zen/gui/PanelClickGui.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/shit/zen/gui/PanelClickGui.java b/src/main/java/shit/zen/gui/PanelClickGui.java index 982ca7c..84be97b 100644 --- a/src/main/java/shit/zen/gui/PanelClickGui.java +++ b/src/main/java/shit/zen/gui/PanelClickGui.java @@ -144,13 +144,18 @@ extends Screen { int panelY = centerY - panelHeight / 2; float effectiveAlpha = this.panelAlpha * dup; if (effectiveAlpha > 0.005f) { - this.drawPanelGlow(guiGraphics, panelX, panelY, partialTicks, effectiveAlpha); - this.categoryBar.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.currentScale, effectiveAlpha); - this.moduleListPanel.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.getSelectedCategory(), this.currentScale, effectiveAlpha); - this.settingsPanel.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.moduleListPanel.getHoveredModule(), this.currentScale, effectiveAlpha); - this.profileWidget.render(guiGraphics, panelX, panelY, mouseX, mouseY, this.currentScale, effectiveAlpha); - this.drawSearchBar(guiGraphics, panelX, panelY, mouseX, mouseY, effectiveAlpha); - this.drawToasts(guiGraphics, panelX, panelY, effectiveAlpha); + final float finalAlpha = effectiveAlpha; + final int fPanelX = panelX; + final int fPanelY = panelY; + Renderer.render(guiGraphics, drawContext -> { + this.drawPanelGlow(guiGraphics, fPanelX, fPanelY, partialTicks, finalAlpha); + this.categoryBar.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.currentScale, finalAlpha); + this.moduleListPanel.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.getSelectedCategory(), this.currentScale, finalAlpha); + this.settingsPanel.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.moduleListPanel.getHoveredModule(), this.currentScale, finalAlpha); + this.profileWidget.render(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, this.currentScale, finalAlpha); + this.drawSearchBar(guiGraphics, fPanelX, fPanelY, mouseX, mouseY, finalAlpha); + this.drawToasts(guiGraphics, fPanelX, fPanelY, finalAlpha); + }); } super.render(guiGraphics, mouseX, mouseY, partialTicks); guiGraphics.pose().popPose();