-
Notifications
You must be signed in to change notification settings - Fork 0
26.2 ModVersionGuard and Safety
This document details the zero-dependency runtime classloader checks, version guard architecture, and bytecode protection mechanisms in Item Clumps for Minecraft 26.2.
| Property | Value |
|---|---|
| System Name | Knot ClassLoader Version Guard |
| Target Class | net.instantgratification.item_clumps.util.ModVersionGuard |
| Verified Class | net.minecraft.world.entity.item.ItemEntity |
| Library Verification |
net.dasik.social.api.config.ConfigHelper (Requires DasikLibrary |
| Safety Objective | Prevent world corruption if loaded on an incompatible Minecraft API |
In Fabric Loader, mod classes are loaded across distinct classloaders (Knot ClassLoader vs. system application classloader). A standard Class.forName(name) call can falsely fail or resolve outdated classes if it does not query the active thread context loader.
Item Clumps implements a dual-stage classloader resolution:
┌───────────────────────────────────┐
│ ModVersionGuard.checkClass Invoked│
└─────────────────┬─────────────────┘
│
▼
┌───────────────────────────────────┐
│ Query Knot Thread Context Loader │
│ Thread.currentThread() │
│ .getContextClassLoader() │
└─────────────────┬─────────────────┘
│
┌────────────────┴────────────────┐
│ (Success) │ (ClassNotFoundException)
▼ ▼
┌───────────────────────────┐ ┌───────────────────────────┐
│ Game Continues Execution │ │ Fallback to Current Loader│
│ Safe Runtime Verified │ │ ModVersionGuard.class │
└───────────────────────────┘ │ .getClassLoader() │
└─────────────┬─────────────┘
│
┌────────────────┴────────────────┐
│ (Success) │ (ClassNotFoundException)
▼ ▼
┌───────────────────────────┐ ┌───────────────────────────┐
│ Game Continues Execution │ │ Throw Descriptive Warning │
│ Safe Runtime Verified │ │ Halt Corrupted World Load │
└───────────────────────────┘ └───────────────────────────┘
From ModVersionGuard.java in Minecraft 26.2:
// Copyright (C) 2026 Dasik (Rifaditya) | GNU GPLv3
package net.instantgratification.item_clumps.util;
public final class ModVersionGuard {
private ModVersionGuard() {}
public static void checkClass(String modName, String requiredClassName) {
ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
ClassLoader currentLoader = ModVersionGuard.class.getClassLoader();
try {
if (contextLoader != null) {
Class.forName(requiredClassName, false, contextLoader);
} else {
Class.forName(requiredClassName, false, currentLoader);
}
} catch (ClassNotFoundException e) {
try {
Class.forName(requiredClassName, false, currentLoader);
} catch (ClassNotFoundException e2) {
throw new RuntimeException("\n" +
"=====================================================================\n" +
" [PRE-RELEASE / VERSION GUARD WARNING] " + modName + "\n" +
"---------------------------------------------------------------------\n" +
" CRITICAL: Incompatible Minecraft Game Runtime or Missing Class!\n" +
" Required Class : " + requiredClassName + "\n" +
" Status : UNRESOLVED AT RUNTIME\n\n" +
" Safety Protection:\n" +
" Execution halted to prevent unreleased/incompatible build deployment\n" +
" or broken world state save corruption.\n\n" +
" Troubleshooting Steps:\n" +
" 1. Verify target Minecraft version (26.2+ release drop).\n" +
" 2. Ensure all required dependencies (Fabric API, DasikLibrary) are loaded.\n" +
" 3. Build/Download a verified matching release JAR from Modrinth/CurseForge.\n" +
"=====================================================================");
}
}
}
}Item Clumps is engineered with ❤️ by Dasik (Rifaditya) | Licensed under GNU General Public License v3.0 (GPL-3.0-or-later).
📌 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.
- 26.2 Hub
- 26.2 Mega-Stack Clumping
- 26.2 Smart Pickup System
- 26.2 Hopper Integration
- 26.2 Despawn Age Rules
- 26.2 Holographic Labels
- 26.2 Mod Compatibility
- 26.2 GameRules Table
- 26.2 Commands & Admin
- 26.2 Advancements
- 26.2 Configuration
- 26.2 ModVersionGuard
- 26.2 Architecture & Mixins
- 26.2 Developer Setup
- 26.2 API & Addons
- 26.2 FAQ & Diagnostics
- 26.1.2 Hub
- 26.1.2 Mega-Stack Clumping
- 26.1.2 Smart Pickup System
- 26.1.2 Hopper Integration
- 26.1.2 Despawn Age Rules
- 26.1.2 Holographic Labels
- 26.1.2 GameRules Table
- 26.1.2 Commands & Admin
- 26.1.2 Advancements
- 26.1.2 Configuration
- 26.1.2 Architecture & Mixins
- 26.1.2 Developer Setup
- 26.1.2 API & Addons
- 26.1.2 FAQ & Diagnostics