mirror of
https://github.com/xiaozhou233/OrangeX-Client.git
synced 2026-12-05 21:15:53 +08:00
Feat: Support Fabric 26.2 injection
- Expose OrangeX.jar through KnotClassDelegate.addCodeSource for Fabric - Resolve 26.2 mappings by runtime class visibility instead of loader type - Keep identity mappings for the current Mojang-named Fabric 26.2 runtime
This commit is contained in:
1 parent
1699df9c5d
commit
40ca99f853
2 files changed
+64
-7
No files matched your search
@@ -31,15 +31,16 @@ public class MappingManager {
|
||||
}
|
||||
|
||||
case V26_2: {
|
||||
if (loaderType == LoaderType.VANILLA
|
||||
|| loaderType == LoaderType.MCP
|
||||
|| loaderType == LoaderType.NEOFORGE) {
|
||||
// 26.x runtimes use Mojang names for classes, fields and
|
||||
// methods, so no obfuscation mapping is needed.
|
||||
// 26.x normally uses Mojang names. Fabric 26.2 currently ships
|
||||
// empty intermediary mappings, so it also runs with Mojang
|
||||
// names. Verify the runtime instead of trusting the loader type.
|
||||
if (usesMojangNames(info)) {
|
||||
resolver = new IdentityFallbackMappingResolver();
|
||||
} else {
|
||||
throw new RuntimeException(
|
||||
"Unsupported loader for 26.2: " + loaderType);
|
||||
"Unsupported runtime naming for 26.2 ("
|
||||
+ loaderType + "): expected "
|
||||
+ "net.minecraft.client.Minecraft");
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -54,6 +55,20 @@ public class MappingManager {
|
||||
return resolver != null;
|
||||
}
|
||||
|
||||
private static boolean usesMojangNames(RuntimeInfo info) {
|
||||
ClassLoader loader = info.getMinecraftClassLoader();
|
||||
if (loader == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
Class.forName("net.minecraft.client.Minecraft", false, loader);
|
||||
return true;
|
||||
} catch (Throwable ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static MappingResolver getResolver() {
|
||||
if (!isInitialized()) {
|
||||
System.out.println("Resolver not initialized!");
|
||||
|
||||
Reference in new issue
Block a user