Skip to content

Commit

Permalink
Keep Mixin 0.9.2 compat mods first in load order
Browse files Browse the repository at this point in the history
Temporary fix for FabricMC/Mixin#89
  • Loading branch information
TibiNonEst committed May 6, 2022
1 parent 8ae5219 commit f3207b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static void init(EnvType side, QuiltLoaderImpl loader) {
initialized = true;
}

private static final class MixinConfigDecorator {
public static final class MixinConfigDecorator {
private static final List<LoaderMixinVersionEntry> versions = new ArrayList<>();

static {
Expand All @@ -152,7 +152,7 @@ static void apply(Map<String, ModContainerImpl> configToModMap) {
}
}

private static int getMixinCompat(ModContainerImpl mod) {
public static int getMixinCompat(ModContainerImpl mod) {
// infer from loader dependency by determining the least relevant loader version the mod accepts
// AND any loader deps

Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/quiltmc/loader/impl/QuiltLoaderImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.quiltmc.loader.impl.game.GameProvider;
import net.fabricmc.loader.launch.common.FabricLauncher;
import net.fabricmc.loader.launch.common.FabricLauncherBase;
import net.fabricmc.loader.launch.common.FabricMixinBootstrap;
import net.fabricmc.loader.launch.knot.Knot;

import org.quiltmc.loader.impl.metadata.qmj.AdapterLoadableClassEntry;
Expand All @@ -71,6 +72,8 @@
import org.quiltmc.loader.impl.util.log.Log;
import org.quiltmc.loader.impl.util.log.LogCategory;

import org.spongepowered.asm.mixin.FabricUtil;

public final class QuiltLoaderImpl {
public static final QuiltLoaderImpl INSTANCE = InitHelper.get();

Expand Down Expand Up @@ -259,6 +262,19 @@ private void setup() throws ModResolutionException {
}
}

// Keep Mixin 0.9.2 compatible mods first in the load order, temporary fix for https://github.com/FabricMC/Mixin/issues/89
List<ModCandidate> newMixinCompatMods = new ArrayList<>();
for (Iterator<ModCandidate> it = modCandidates.iterator(); it.hasNext();) {
ModCandidate mod = it.next();
ModContainerImpl tempModContainer = new ModContainerImpl(mod);
if (FabricMixinBootstrap.MixinConfigDecorator.getMixinCompat(tempModContainer) != FabricUtil.COMPATIBILITY_0_9_2) {
it.remove();
newMixinCompatMods.add(mod);
}
}

modCandidates.addAll(newMixinCompatMods);

String modsToLoadLate = System.getProperty(SystemProperties.DEBUG_LOAD_LATE);

if (modsToLoadLate != null) {
Expand Down

0 comments on commit f3207b3

Please sign in to comment.