🧩 Architecture & Mixin Subsystem
| Parameter | Specification |
|---|---|
| Mixin Configuration | src/main/resources/collapsible-game-rules.mixins.json |
| Refmap Identifier | collapsible-game-rules-refmap.json |
| Compatibility Level | JAVA_25 |
| Default Require | 1 |
| Root Package | net.instantgratification.collapsiblegamerules |
| Mixin Package | net.instantgratification.collapsiblegamerules.mixin |
| Total Mixins | 4 Client Mixins (3 Class Injectors + 1 Interface Accessor) |
📖 System Package Architecture
net.instantgratification.collapsiblegamerules
├── CollapsibleGameRulesFabric.java ──> Main ModInitializer (Guard & Hard Dependency check)
├── CollapsibleGameRulesFabricClient.java ──> ClientModInitializer (Loads GameRuleStateConfig)
├── GameRuleStateConfig.java ──> Config & JSON state persistence (Set<String>)
├── mixin
│ ├── AbstractGameRulesScreenRuleListMixin.java ──> Core engine (List interception, CollapsibleCategoryRuleEntry)
│ ├── CategoryRuleEntryAccessor.java ──> Interface Accessor for category Component label
│ ├── IntegerRuleEntryMixin.java ──> Abstract wrapper for integer rule entries
│ └── ScreenMixin.java ──> Intercepts Screen.removed() to flush pending state
├── preset
│ └── GameRulePresetEngine.java ──> Built-in preset definitions (Builder, Fast Play, Hardcore)
├── ui
│ ├── BooleanToggleWidget.java ──> Interactive emerald green / ruby red toggle switch
│ ├── GlobalActionsRuleEntry.java ──> Pinned index 0 bulk toggle header ([ Expand ] / [ Collapse ])
│ └── IntegerSliderWidget.java ──> Draggable numeric slider with math normalization
└── util
├── CategoryPrettifier.java ──> Regex & string parser for unlocalized category keys
├── DasikMetadataHelper.java ──> Lazy-loaded isolation layer querying DasikLibrary
├── GameRuleSliderHelper.java ──> Vanilla integer rule bounds and default values
└── ModVersionGuard.java ──> Zero-dependency runtime Knot ClassLoader integrity check🔍 Complete Mixin Target Breakdown
1. AbstractGameRulesScreenRuleListMixin
- Target Class:
net.minecraft.client.gui.screens.worldselection.AbstractGameRulesScreen.RuleList.class - Hierarchy: Extends
ContainerObjectSelectionList<AbstractGameRulesScreen.RuleEntry> - Role: Primary UI controller. Intercepts list population, calculates child count per category, filters visible entries based on expansion states, and renders custom interactive category headers.
java
@Mixin(AbstractGameRulesScreen.RuleList.class)
public abstract class AbstractGameRulesScreenRuleListMixin
extends ContainerObjectSelectionList<AbstractGameRulesScreen.RuleEntry> {
@Unique
private List<AbstractGameRulesScreen.RuleEntry> collapsible_game_rules$allEntries = new ArrayList<>();
@Unique
private String collapsible_game_rules$currentFilter = "";
@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) : "";
this.collapsible_game_rules$allEntries = new ArrayList<>(this.children());
this.collapsible_game_rules$updateVisibleEntries();
}
}2. CategoryRuleEntryAccessor
- Target Class:
net.minecraft.client.gui.screens.worldselection.AbstractGameRulesScreen.CategoryRuleEntry.class - Role: Provides direct bytecode accessor to the private
Component labelfield of vanilla category entries.
java
@Mixin(AbstractGameRulesScreen.CategoryRuleEntry.class)
public interface CategoryRuleEntryAccessor {
@Accessor("label")
Component collapsible_game_rules$getLabel();
}3. ScreenMixin
- Target Class:
net.minecraft.client.gui.screens.Screen.class - Role: Listens for screen removal. Whenever
AbstractGameRulesScreenis closed, flushes pending state modifications to disk viaGameRuleStateConfig.saveIfDirty().
java
@Mixin(Screen.class)
public abstract class ScreenMixin {
@Inject(method = "removed", at = @At("HEAD"))
private void collapsible_game_rules$onRemoved(CallbackInfo ci) {
if ((Object) this instanceof AbstractGameRulesScreen) {
GameRuleStateConfig.saveIfDirty();
}
}
}4. IntegerRuleEntryMixin
- Target Class:
net.minecraft.client.gui.screens.worldselection.AbstractGameRulesScreen.IntegerRuleEntry.class - Role: Provides an abstract bridge into vanilla integer rule entries for specialized widget integration.
java
@Mixin(AbstractGameRulesScreen.IntegerRuleEntry.class)
public abstract class IntegerRuleEntryMixin extends AbstractGameRulesScreen.RuleEntry {
public IntegerRuleEntryMixin() {
super(null);
}
}📜 Mixin Configuration File (collapsible-game-rules.mixins.json)
json
{
"required": true,
"package": "net.instantgratification.collapsiblegamerules.mixin",
"refmap": "collapsible-game-rules-refmap.json",
"compatibilityLevel": "JAVA_25",
"client": [
"ScreenMixin",
"AbstractGameRulesScreenRuleListMixin",
"CategoryRuleEntryAccessor",
"IntegerRuleEntryMixin"
],
"injectors": {
"defaultRequire": 1
}
}