mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-20 05:19:35 +00:00
Update to register VirtualJar for synthetic classes
This commit is contained in:
1 parent
e02f4cae3f
commit
5aa23b532a
3 files changed
+43
-8
No files matched your search
+3
-3
@@ -63,8 +63,8 @@ repositories {
|
||||
}
|
||||
maven {
|
||||
// For modlauncher
|
||||
name = 'forge'
|
||||
url = 'https://files.minecraftforge.net/maven'
|
||||
name = 'neoforged'
|
||||
url = 'https://maven.neoforged.net/releases'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ dependencies {
|
||||
modlauncher9Implementation ("cpw.mods:modlauncher:$modlauncherVersion") {
|
||||
exclude module: 'jopt-simple'
|
||||
}
|
||||
modlauncher9Implementation 'cpw.mods:securejarhandler:0.9.+'
|
||||
modlauncher9Implementation 'cpw.mods:securejarhandler:2.1.24'
|
||||
|
||||
// asm bridge
|
||||
bridgeImplementation 'org.apache.logging.log4j:log4j-core:2.0-beta9'
|
||||
|
||||
+2
-2
@@ -8,6 +8,6 @@ buildVersion=0.8.6
|
||||
buildType=SNAPSHOT
|
||||
asmVersion=9.2
|
||||
legacyForgeAsmVersion=5.0.3
|
||||
modlauncherAsmVersion=9.1
|
||||
modlauncherVersion=9.0.7
|
||||
modlauncherAsmVersion=9.5
|
||||
modlauncherVersion=10.0.9
|
||||
legacyModlauncherVersion=7.0.0
|
||||
@@ -24,11 +24,46 @@
|
||||
*/
|
||||
package org.spongepowered.asm.launch;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.injection.invoke.arg.ArgsClassGenerator;
|
||||
import org.spongepowered.asm.service.MixinService;
|
||||
import org.spongepowered.asm.util.Constants;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import cpw.mods.jarhandling.SecureJar;
|
||||
import cpw.mods.jarhandling.VirtualJar;
|
||||
import cpw.mods.modlauncher.api.IModuleLayerManager;
|
||||
|
||||
/**
|
||||
* Service for handling transforms mixin under ModLauncher, now just a concrete
|
||||
* class which extends the abstract base class used for pre-9 versions of
|
||||
* ModLauncher
|
||||
* Service for handling transforms mixin under ModLauncher, most of the
|
||||
* functionality is provided by the abstract base class used for pre-9 versions
|
||||
* of ModLauncher, though we also handle SecureJarHandler requirements here, for
|
||||
* modlauncher 10+
|
||||
*/
|
||||
public class MixinTransformationService extends MixinTransformationServiceAbstract {
|
||||
|
||||
private static final String VIRTUAL_JAR_CLASS = "cpw.mods.jarhandling.VirtualJar";
|
||||
|
||||
@Override
|
||||
public List<Resource> completeScan(final IModuleLayerManager layerManager) {
|
||||
try {
|
||||
MixinService.getService().getClassProvider().findClass(MixinTransformationService.VIRTUAL_JAR_CLASS, false);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
// VirtualJar not supported
|
||||
return super.completeScan(layerManager);
|
||||
}
|
||||
|
||||
try {
|
||||
Path codeSource = Path.of(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI());
|
||||
VirtualJar jar = new VirtualJar("mixin_synthetic", codeSource, Constants.SYNTHETIC_PACKAGE, ArgsClassGenerator.SYNTHETIC_PACKAGE);
|
||||
return ImmutableList.<Resource>of(new Resource(IModuleLayerManager.Layer.GAME, ImmutableList.<SecureJar>of(jar)));
|
||||
} catch (URISyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user