🖥️ HUD, Diagnostics & UI Rendering
| Parameter | Specification |
|---|---|
| Graphics Extraction Engine | net.minecraft.client.gui.GuiGraphicsExtractor |
| Target Screen Context | net.minecraft.client.gui.screens.worldselection.AbstractGameRulesScreen |
| Hover Text Tint | 0xFFFFFFAA (Soft Yellow Highlight) |
| Default Text Tint | 0xFFFFFFFF (Crisp White) |
| Header Hover Box | 0x22FFFFFF (Subtle Alpha Overlay) |
| Category Separator Line | 0x44AAAAAA (Horizontal Border) |
| Toggle Active Color | 0x4400FF00 (Emerald Green) |
| Toggle Inactive Color | 0x44FF0000 (Ruby Red) |
| Accessibility Narration | NarratedElementType.TITLE (NarrationPriority.HOVERED) |
📖 Overview
Minecraft 26.2 introduced major refactors to the client rendering pipeline, migrating standard GUI drawing operations to the modern GuiGraphicsExtractor subsystem.
Collapsible Game Rules is built natively for this rendering engine, utilizing direct vector color fills, font metrics centering, and accessibility narration output with zero frame-rate overhead.
🎨 Color Palette & Visual Diagnostics
| Visual Component | Hex ARGB Code | Visual Description | Usage Location |
|---|---|---|---|
| Hover Fill | 0x22FFFFFF | 13% opacity white box overlay. | Category header hover & Global actions hover. |
| Border Divider | 0x44AAAAAA | 27% opacity light gray 1px line. | Bottom edge of category headers and global actions. |
| Hovered Text | 0xFFFFFFAA | Soft yellow highlighted text. | Category header text & button labels on mouse hover. |
| Standard Text | 0xFFFFFFFF | 100% white text. | Category header title & child count badge. |
| Child Count Badge | ChatFormatting.GRAY | Vanilla gray text ( (N rules)). | Suffix appended to category header labels. |
| Toggle Active BG | 0x4400FF00 | 27% opacity emerald green. | Background for ✔ ON state in BooleanToggleWidget. |
| Toggle Inactive BG | 0x44FF0000 | 27% opacity ruby red. | Background for ✖ OFF state in BooleanToggleWidget. |
💻 Rendering Implementation Details
Modern GuiGraphicsExtractor Pipeline
Inside CollapsibleCategoryRuleEntry.extractContent(...):
java
@Override
public void extractContent(GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean hovered, float a) {
// 1. Premium Highlight on hover
if (hovered) {
graphics.fill(this.getX() - 2, this.getY(), this.getX() + this.getWidth() + 2, this.getY() + 24, 0x22FFFFFF);
}
// 2. Directional arrow, label, and child count badge
String prefix = this.expanded ? "▼ " : "▶ ";
Component countBadge = Component.literal(" (" + this.childCount + " rules)").withStyle(ChatFormatting.GRAY);
Component display = Component.literal(prefix).append(this.label).append(countBadge);
// 3. Centered text with dynamic hover tint
graphics.centeredText(Minecraft.getInstance().font, display,
this.getContentXMiddle(), this.getContentY() + 5, hovered ? 0xFFFFFFAA : 0xFFFFFFFF);
// 4. Subtle separating line at the bottom
graphics.fill(this.getX() + 10, this.getY() + 23, this.getX() + this.getWidth() - 10, this.getY() + 24, 0x44AAAAAA);
}🔊 Audio & Accessibility Diagnostics
Whenever players interact with the UI, standard vanilla sounds provide tactile feedback:
- Event:
SoundEvents.UI_BUTTON_CLICK - Volume:
1.0F - Pitch:
1.0F - Trigger Conditions:
- Mouse left or right click on Category Header.
- Keyboard Space / Enter on Category Header.
- Keyboard Left Arrow (collapse) or Right Arrow (expand).
- Mouse click on
[ Expand All ]or[ Collapse All ].
