-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Collapsible Categories
| Parameter | Specification |
|---|---|
| System Component |
CollapsibleCategoryRuleEntry (Inner Class) |
| Enclosing Mixin | AbstractGameRulesScreenRuleListMixin |
| Target Class | net.minecraft.client.gui.screens.worldselection.AbstractGameRulesScreen.RuleList |
| Indicator Icons | Expanded: โผ | Collapsed: โถ
|
| Count Badge Format |
(N rules) in ChatFormatting.GRAY
|
| Hover Highlight Color |
0x22FFFFFF (25% Alpha White Box) |
| Separator Line Color |
0x44AAAAAA (Subtle Bottom Divider) |
| Text Color | Hovered: 0xFFFFFFAA | Normal: 0xFFFFFFFF
|
| Interaction Sound |
net.minecraft.sounds.SoundEvents.UI_BUTTON_CLICK (Volume: 1.0F) |
| Narration Type |
NarratedElementType.TITLE (NarrationPriority.HOVERED) |
In vanilla Minecraft, the Game Rules screen renders category headers as static, non-interactive text labels (CategoryRuleEntry), with all child rules listed sequentially in a single scrolling pane. When mods add dozens of custom GameRules, the screen becomes excessively long and difficult to navigate.
Collapsible Categories replaces static headers with interactive CollapsibleCategoryRuleEntry widgets that can be expanded or collapsed at will.
When rendered inside the RuleList, each category header features dynamic visual indicators and status badges:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ [ Expand All ] [ Collapse All ] โ โโโ GlobalActionsRuleEntry (Index 0)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โผ โ๏ธ Mobs (14 rules) โ โโโ CollapsibleCategoryRuleEntry (Expanded)
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ mobGriefing [ ON ] โ โโโ Child RuleEntry
โ doMobSpawning [ ON ] โ โโโ Child RuleEntry
โ doMobLoot [ ON ] โ โโโ Child RuleEntry
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โถ ๐ค Player (8 rules) โ โโโ CollapsibleCategoryRuleEntry (Collapsed)
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ ๐ง๏ธ Updates (6 rules) โ โโโ CollapsibleCategoryRuleEntry (Expanded)
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ doFireTick [ ON ] โ โโโ Child RuleEntry
โ randomTickSpeed [ 3 ] โ โโโ Child RuleEntry
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
When updateVisibleEntries() iterates through allEntries, it determines the exact number of child rules belonging to a category before the next category begins:
int childCount = 0;
for (int j = i + 1; j < this.collapsible_game_rules$allEntries.size(); j++) {
if (this.collapsible_game_rules$allEntries.get(j) instanceof AbstractGameRulesScreen.CategoryRuleEntry) {
break;
}
childCount++;
}The rendering process is executed via Minecraft's modern GuiGraphicsExtractor interface:
-
Hover Box: If the cursor hovers over the category entry, a semi-transparent box (
0x22FFFFFF) is drawn across[getX() - 2, getY()]to[getX() + getWidth() + 2, getY() + 24]. -
Directional Arrow & Text: The prefix (
โผif expanded,โถif collapsed) is prepended to the category label, followed by the gray child count badge ((N rules)). -
Centered Alignment: The combined component is drawn centered horizontally at
getContentXMiddle()with vertical offsetgetContentY() + 5. -
Bottom Divider: A subtle dividing line (
0x44AAAAAA) is drawn atgetY() + 23across the entry width to demarcate category boundaries.
The category header captures mouse clicks in mouseClicked(MouseButtonEvent event, boolean doubleClick):
-
Left Click (
event.button() == 0) or Right Click (event.button() == 1):- Invokes the category's
toggleAction.run(). - Updates
GameRuleStateConfigwith the new boolean state. - Plays the vanilla UI click sound:
SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F). - Triggers
updateVisibleEntries()to dynamically add or remove child rule entries from the active list. - Recalculates list dimensions via
updateSizeAndPosition(...).
- Invokes the category's
CollapsibleCategoryRuleEntry implements NarratableEntry:
-
Priority:
NarrationPriority.HOVERED -
Narration Output: Pushes the category label as
NarratedElementType.TITLEto ensure screen readers narrate the active category name when focused or hovered.
Collapsible Game Rules โข Built & Maintained by Dasik (Rifaditya)
Released under the GNU General Public License v3.0 (GPL-3.0-or-later)
GitHub Repository โข Modrinth โข CurseForge โข Issue Tracker
๐ Repository Source Disclaimer: The documentation in this Wiki reflects the current source code state in the repository, which may include recent unreleased commits or developmental features ahead of public release builds on CurseForge and Modrinth.
- ๐๏ธ Collapsible Categories
- ๐ Global Actions & Bulk Toggles
- ๐ Smart Search Integration
- โจ๏ธ Keyboard Navigation & Accessibility
- ๐ง State Persistence & JSON Config
- โจ Category Prettification & Naming
- ๐๏ธ Game Rule Presets & Widgets
- ๐ GameRules Reference Table
- ๐ฌ Brigadier Commands & Absence Scope
- ๐ Advancements & Absence Scope
- ๐ฅ๏ธ HUD, Diagnostics & Rendering
- ๐ ๏ธ Developer Setup & Gradle Builds
- ๐งฉ Architecture & Mixin Subsystem
- ๐ DasikLibrary API Integration