Short description of the issue
When a button’s text exceeds its fixed width, the game activates a horizontal scrolling display for that label. If such a button is positioned outside the visible window area on a screen that does not have a scrollable container (i.e., no ScrollPanel or List viewport clipping), the renderer computes an empty intersection rectangle with a height of 0 and passes it to the scissor function, causing an immediate crash. Screens with scroll bars are not affected because they use a different rendering path that properly clips or culls off‑screen content.
Steps to reproduce the issue
Create a resource pack that overrides any button label on a non‑scrollable GUI screen (e.g., the Friends List confirmation dialog for enabling/disabling the Friends List, or any settings button that is not inside a scrolling list) to a very long string – for example,
"Turn ON"followed by 30+ extra characters.Load the resource pack and launch the game.
Navigate to that screen. The button will display its text as horizontally scrolling.
Force the button to move outside the window’s visible area by either:
Reducing the game window height until the button is out of edge, or
Adding many newlines to a preceding text element (if present) to shift the button downward.
The game crashes immediately with the exception below.
Expected result
The button should be properly clipped or culled when off‑screen. The game should not crash.
Actual result
The game crashes with a ReportedException during the render frame.
Launcher output:
text
Reported exception thrown!
net.minecraft.ReportedException: Render Frame
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1274)
...
Caused by: java.lang.IllegalArgumentException: Scissor size must be >0, was 292x0
at com.mojang.blaze3d.systems.RenderPass.enableScissor(RenderPass.java:110)
at net.minecraft.client.gui.render.GuiRenderer.enableScissor(GuiRenderer.java:418)
...The crash screen shows: The game crashed: render frame Error: java.lang.IllegalArgumentException: Scissor size must be >0, was 292x0.
Analysis & Root Cause
The crash is triggered only on GUI screens without a scroll bar (e.g., Game Menu). This explains why the internal testing may have missed the bug – most long button texts naturally appear in scrollable lists (like the Options menu), where the scroll‑container’s rendering logic handles off‑screen elements safely.
Why scrollable pages are immune:
In a
ScrollPanelorListwidget, the renderer clips the entire panel’s content to its viewport using a scissor region that matches the panel’s visible area.Before rendering any child element (including buttons), the layout system checks if the element’s bounding box intersects the panel’s viewport. If it does not, the element is culled entirely – no rendering calls are made.
Even if an element is partially visible, the scissor region is already set to the viewport, so any intersection with the button is always positive (or the button is skipped). There is no separate calculation of the button‑window intersection that could yield zero height.
Why non‑scrollable screens crash:
The button’s rendering code for overflowing text (the horizontal scrolling path) does not benefit from a viewport‑level scissor or culling.
The renderer computes the intersection between the button’s bounding box and the raw game window (not a panel viewport). If the button is entirely below the window’s bottom edge, this intersection has a height of
0(width remains positive, e.g., 292).The code then passes
(x, y, 292, 0)toRenderPass.enableScissor()without verifying that the height is positive.The strict validation in
RenderPassthrows the exception, as zero‑height scissor rectangles are invalid for graphics APIs.
Suggested fix
In the button’s rendering method (specifically the path for horizontal scrolling text), add a guard: before calling
enableScissor, check if the calculated intersection width or height is ≤ 0. If so, return immediately (skip rendering the button).Alternatively, modify
GuiRenderer.enableScissor()to silently ignore zero‑area rectangles instead of throwing an exception, treating them as “no clipping needed”.For consistency, ensure that all GUI elements use the same culling logic as scrollable panels – i.e., check visibility against the window bounds before any scissor operation.
Attachments
Comments 0
No comments.