Support MM1 in addition to MM2 (fixes #162)

Cause the latest OptiFabric on 1.14.4 still ships that and it has no support for
entrypoints.
This commit is contained in:
Jonas Herzig
2020-05-23 22:31:01 +02:00
parent 363a8d595c
commit 3c526a6cd4
2 changed files with 13 additions and 0 deletions

View File

@@ -12,8 +12,18 @@ import java.util.Optional;
// We need to wait for MM to call us, otherwise we might initialize our mixins before it calls optifabric which would
// result in OF classes not existing while our mixins get resolved.
public class ReplayModMMLauncher implements Runnable {
private static boolean ran;
@Override
public void run() {
// If this is MM2, then we're currently getting called because of our entrypoint declaration.
// For backwards compatibility with MM1, we also declare our early_riser via custom metadata and MM2 supports
// that as well and will therefore call us twice.
if (ran) {
return;
}
ran = true;
Mixins.addConfiguration("mixins.compat.mapwriter.replaymod.json");
Mixins.addConfiguration("mixins.compat.shaders.replaymod.json");
Mixins.addConfiguration("mixins.core.replaymod.json");

View File

@@ -40,6 +40,9 @@
},
"custom": {
"mm:early_risers": [
"com.replaymod.core.ReplayModMMLauncher"
],
"modmenu:clientsideOnly": true
}
}