-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 Smart Search Integration
| Parameter | Specification |
|---|---|
| Intercepted Method | populateChildren(Ljava/lang/String;)V |
| Injection Point | @At("TAIL") |
| Mixin Class | AbstractGameRulesScreenRuleListMixin |
| Query Normalization | filter.toLowerCase(java.util.Locale.ROOT) |
| Active Query Flag | isSearching = !currentFilter.isEmpty() |
| Dynamic State Rule | `isExpanded = isSearching |
| Rebuild Method | collapsible_game_rules$updateVisibleEntries() |
In vanilla Minecraft, the Game Rules search bar filters the rule list by matching rule names or descriptions against player input. In a collapsible interface, a naive implementation would risk hiding matching rules inside closed category folders.
Smart Search Integration solves this problem by monitoring search query changes in real time. Whenever a search query is active, any category containing a matching rule automatically expands, displaying the search results immediately without requiring extra clicks.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SMART SEARCH PIPELINE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ Player types query into Search Bar (e.g. "fire") โ
โ โ โ
โ โผ โ
โ Vanilla AbstractGameRulesScreen.RuleList.populateChildren("fire") โ
โ (Filters the internal list to matching rules & their category headers) โ
โ โ โ
โ โผ (@Inject at TAIL) โ
โ AbstractGameRulesScreenRuleListMixin.collapsible_game_rules$onPopulate... โ
โ โโ Stores normalized query: filter.toLowerCase(Locale.ROOT) โ
โ โโ Captures filtered list: allEntries = new ArrayList<>(children()) โ
โ โโ Calls updateVisibleEntries() โ
โ โ โ
โ โผ โ
โ isSearching = !currentFilter.isEmpty() (Evaluates to TRUE) โ
โ โ โ
โ โผ โ
โ Every present category header is forced isExpanded = TRUE โ
โ All matched child rules render immediately! โ
โ โ
โ Player clears Search Bar ("") โ
โ โ โ
โ โผ โ
โ isSearching = FALSE โโ> Reverts to persistent GameRuleStateConfig states! โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The mixin intercepts the conclusion of vanilla's populateChildren method:
@Inject(method = "populateChildren(Ljava/lang/String;)V", at = @At("TAIL"))
private void collapsible_game_rules$onPopulateChildren(String filter, CallbackInfo ci) {
this.collapsible_game_rules$currentFilter = (filter != null) ? filter.toLowerCase(java.util.Locale.ROOT) : "";
// Save the currently generated list of all entries
this.collapsible_game_rules$allEntries = new ArrayList<>(this.children());
this.collapsible_game_rules$updateVisibleEntries();
}Inside updateVisibleEntries(), the expansion state is computed dynamically:
boolean isSearching = !this.collapsible_game_rules$currentFilter.isEmpty();
final String finalPersistenceKey = persistenceKey;
boolean isExpanded = isSearching || GameRuleStateConfig.isExpanded(finalPersistenceKey);Because isSearching is an ephemeral condition evaluated only during active filtering, clearing the search box immediately restores each category's exact manual collapse state from GameRuleStateConfig without overwriting the player's saved preferences on disk.
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