diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassHeirachyManagerMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassHeirachyManagerMixin.java deleted file mode 100644 index c06f698d..00000000 --- a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassHeirachyManagerMixin.java +++ /dev/null @@ -1,14 +0,0 @@ -package fr.catcore.fabricatedforge.compat.mixin.codechickencore; - -import codechicken.core.asm.ClassHeirachyManager; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(ClassHeirachyManager.class) -public class ClassHeirachyManagerMixin { - @Redirect(method = "classExtends(Ljava/lang/String;Ljava/lang/String;)Z", at = @At(value = "INVOKE", target = "Ljava/lang/Class;forName(Ljava/lang/String;)Ljava/lang/Class;", remap = false), remap = false) - private static Class fixClassExtends(String className) throws ClassNotFoundException { - return Class.forName(className, false, ClassHeirachyManager.class.getClassLoader()); - } -} diff --git a/mod-compat/src/main/resources/fabricated-forge.mods.mixins.json b/mod-compat/src/main/resources/fabricated-forge.mods.mixins.json index 45b543eb..a4455b2f 100644 --- a/mod-compat/src/main/resources/fabricated-forge.mods.mixins.json +++ b/mod-compat/src/main/resources/fabricated-forge.mods.mixins.json @@ -6,7 +6,6 @@ "server": [], "mixins": [ "codechickencore.ASMHelperMixin", - "codechickencore.ClassHeirachyManagerMixin", "codechickencore.ClassMappingMixin", "codechickencore.ClassOverriderMixin", "codechickencore.DelegatedTransformerMixin", diff --git a/src/main/java/cpw/mods/fml/common/ModClassLoader.java b/src/main/java/cpw/mods/fml/common/ModClassLoader.java index 02b5bc40..3565848e 100644 --- a/src/main/java/cpw/mods/fml/common/ModClassLoader.java +++ b/src/main/java/cpw/mods/fml/common/ModClassLoader.java @@ -113,14 +113,6 @@ public File[] getParentSources() { files.add(new File(url.toURI())); } - files = files.stream() - .filter(file -> Objects.equals( - file.getParentFile(), - Constants.COREMODS_FOLDER) - ).collect(Collectors.toList()); - - files.addAll(FabricLauncherBase.getLauncher().getClassPath().stream().map(Path::toFile).collect(Collectors.toList())); - return files.toArray(new File[0]); } catch (URISyntaxException e) { e.printStackTrace(); diff --git a/src/main/java/cpw/mods/fml/common/discovery/ModDiscoverer.java b/src/main/java/cpw/mods/fml/common/discovery/ModDiscoverer.java index 801953c0..c6c110a0 100644 --- a/src/main/java/cpw/mods/fml/common/discovery/ModDiscoverer.java +++ b/src/main/java/cpw/mods/fml/common/discovery/ModDiscoverer.java @@ -21,11 +21,13 @@ import cpw.mods.fml.common.ModClassLoader; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.relauncher.RelaunchLibraryManager; +import fr.catcore.fabricatedforge.Constants; import java.io.File; import java.util.Arrays; import java.util.Iterator; import java.util.List; +import java.util.Objects; import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -54,6 +56,7 @@ public void findClasspathMods(ModClassLoader modClassLoader) { if (knownLibraries.contains(minecraftSources[i].getName())) { FMLLog.finer("Skipping known library file %s", new Object[]{minecraftSources[i].getAbsolutePath()}); } else { + if (!Objects.equals(minecraftSources[i].getParentFile().toString(), Constants.COREMODS_FOLDER.toString())) continue; FMLLog.fine("Found a minecraft related file at %s, examining for mod candidates", new Object[]{minecraftSources[i].getAbsolutePath()}); this.candidates.add(new ModCandidate(minecraftSources[i], minecraftSources[i], ContainerType.JAR, i == 0, true)); } diff --git a/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java b/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java index f35bcfa1..ccf6d9f8 100644 --- a/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java +++ b/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java @@ -24,6 +24,7 @@ import cpw.mods.fml.common.FMLLog; import fr.catcore.fabricatedforge.util.Utils; import fr.catcore.modremapperapi.ClassTransformer; +import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.impl.launch.FabricLauncherBase; import net.fabricmc.loader.impl.util.UrlUtil; @@ -70,7 +71,7 @@ public class RelaunchClassLoader extends URLClassLoader { private static final boolean DEBUG_CLASSLOADING = Boolean.parseBoolean(System.getProperty("fml.debugClassLoading", "false")); public RelaunchClassLoader() { - super(new URL[0], FabricLauncherBase.getLauncher().getTargetClassLoader()); + super(new URL[0], FMLRelauncher.class.getClassLoader()); this.sources = new ArrayList<>(); this.parent = this.getClass().getClassLoader(); this.cachedClasses = new HashMap<>(1000); @@ -271,7 +272,7 @@ public byte[] getClassBytes(String name) throws IOException { Object i$; try { - URL classResource = this.findResource(name.replace('.', '/').concat(".class")); + URL classResource = ((URLClassLoader)this.parent.getParent()).findResource(name.replace('.', '/').concat(".class")); if (classResource != null) { classStream = classResource.openStream(); if (DEBUG_CLASSLOADING) {