-
Notifications
You must be signed in to change notification settings - Fork 0
ModVersionGuard and Startup Safety
Rifa edited this page Aug 9, 2026
·
1 revision
| Class | net.dasik.social.util.ModVersionGuard |
|---|---|
| ClassLoader Policy | Explicit Thread.currentThread().getContextClassLoader()
|
| Banned Pattern | Default Class.forName(name) without ClassLoader |
| Entrypoint Target | DasikLibraryMod.onInitialize() |
In Fabric modding, default Class.forName(String className) uses the system ClassLoader, which fails under Fabric Knot ClassLoader during early mod initialization, throwing a false ClassNotFoundException even when target classes are present.
ModVersionGuard passes Thread.currentThread().getContextClassLoader() explicitly:
public final class ModVersionGuard {
public static void checkClass(String modName, String requiredClassName) {
try {
Class.forName(requiredClassName, true, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new RuntimeException("\n" +
"=====================================================================\n" +
" [" + modName + "] Minecraft API Mismatch!\n" +
" A required Minecraft class or API was not found in your game version.\n" +
" Try updating your Minecraft version or download a matching build.\n" +
"=====================================================================");
}
}
}
Dasik Library | Social AI & Infrastructure Engine
Developed with โค๏ธ by Dasik (Rifaditya) | Licensed under LGPL-3.0
๐ Documentation reflects active repository source code state.
- Hive Mind Social System
- Social Scheduler & Events
- Animal Genetics Engine
- Genetics API & Pedigree
- Genetics Loot Modifiers
- Leader Follower & Flocking
- Dynamic GameRules Manager
- GameRule Codec & Serialization
- Client GameRule & GUI Helpers
- Dynamic Enchantments & Vision
- Stochastic & Math Utilities
- Stale Attribute Purging & Scale
- ModVersionGuard & Startup Safety
- Developer Setup & Building
- Architecture & Package Layout
- Mixin Reference & Hooks
- Behavior Profiles & Conditions
- Consumer Mods Integration Guide