-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 API and Library Integration
| Parameter | Specification |
|---|---|
| Core Dependency | net.dasik.social:dasik-library |
| Declared Constraint |
dasik-library: >=1.7.0 (Active Build: 1.7.4) |
| Isolation Helper Class | net.instantgratification.collapsiblegamerules.util.DasikMetadataHelper |
| Queried API Method | DynamicGameRuleManager.getGeneratedTranslations() |
| Runtime Enforcement | Hard check in CollapsibleGameRulesFabric.onInitialize()
|
Collapsible Game Rules integrates with DasikLibrary to provide dynamic category translation and metadata formatting for modern Minecraft mods.
To maintain absolute JVM stability, all direct class references to DasikLibrary are isolated inside a dedicated lazy-loaded helper class (DasikMetadataHelper).
In modern Java runtimes, referencing a class from another library within a hot class (such as a Mixin) will trigger immediate JVM classloading of the target library. If the library is absent, the JVM throws a fatal NoClassDefFoundError before the mod can gracefully report the error.
By isolating all DynamicGameRuleManager calls into DasikMetadataHelper, the JVM only attempts to load DasikLibrary classes when DasikMetadataHelper is explicitly invoked:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLASSLOADING ISOLATION PATTERN โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ AbstractGameRulesScreenRuleListMixin โ
โ โ โ
โ โผ (Checks FabricLoader.isModLoaded("dasik-library")) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ if (FabricLoader.getInstance().isModLoaded("dasik-library")) { โ โ
โ โ categoryKey = DasikMetadataHelper.getCategoryTranslation(...); โ โ
โ โ } โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ (Only loads DasikMetadataHelper when confirmed safe) โ
โ DasikMetadataHelper โโ> net.dasik.social.api.gamerule.DynamicGameRuleManagerโ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Inside DasikMetadataHelper.java:
public final class DasikMetadataHelper {
private static final Logger LOGGER = LoggerFactory.getLogger("collapsible-game-rules");
private DasikMetadataHelper() {}
/**
* Retrieves the localized name for a category from DasikLibrary metadata.
* Enforced Hard Dependency: This method makes direct calls to DasikLibrary.
*/
public static String getCategoryTranslation(String categoryLabel) {
Map<String, String> translations =
DynamicGameRuleManager.getGeneratedTranslations();
return translations.getOrDefault(
"gamerule.category." + categoryLabel.toLowerCase(Locale.ROOT),
categoryLabel
);
}
}In compliance with the Core Sovereign Architecture, the mod verifies that dasik-library is present during ModInitializer.onInitialize():
public class CollapsibleGameRulesFabric implements ModInitializer {
public static final String MOD_ID = "collapsible-game-rules";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@Override
public void onInitialize() {
ModVersionGuard.checkClass("Collapsible Game Rules", "net.minecraft.world.level.gamerules.GameRules");
LOGGER.info("Initializing Collapsible Game Rules [Core Align 2.1]");
// Hard Dependency Enforcement
if (!FabricLoader.getInstance().isModLoaded("dasik-library")) {
throw new RuntimeException("Collapsible Game Rules requires DasikLibrary to function. Please install it.");
}
}
}
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