Fix incompatibility with mods which mixin into Main (fixes #327)

This commit is contained in:
Jonas Herzig
2020-08-22 14:04:05 +02:00
parent 34b0369775
commit 27edfcb4f3
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
//#if FABRIC>=1
package com.replaymod.core;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
// Required for ReplayModMMLauncher.
//
// Chain-loading mixin configurations only works when the first class that is loaded doesn't have any mixins which
// target it. The first class would ordinarily be MC's Main but there are valid use cases for targeting it, see
// e.g. https://github.com/ReplayMod/ReplayMod/issues/327
// So, instead of relying on the bad assumption that Main doesn't have any mixins, we'll instead register this
// dummy pre-launch entry point which is practically guaranteed to not have any mixins and gets called before Main.
public class DummyChainLoadEntryPoint implements PreLaunchEntrypoint {
@Override
public void onPreLaunch() {
}
}
//#endif

View File

@@ -25,6 +25,9 @@
"modmenu": [ "modmenu": [
"com.replaymod.core.gui.ModMenuApiImpl" "com.replaymod.core.gui.ModMenuApiImpl"
], ],
"preLaunch": [
"com.replaymod.core.DummyChainLoadEntryPoint"
],
"mm:early_risers": [ "mm:early_risers": [
"com.replaymod.core.ReplayModMMLauncher" "com.replaymod.core.ReplayModMMLauncher"
] ]