diff --git a/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java b/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java index f9df7610..df2538ac 100644 --- a/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java +++ b/src/main/java/org/embeddedt/modernfix/core/ModernFixMixinPlugin.java @@ -41,6 +41,9 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin { this.logger.info("Loaded configuration file for ModernFix: {} options available, {} override(s) found", config.getOptionCount(), config.getOptionOverrideCount()); + if(ModernFixEarlyConfig.OPTIFINE_PRESENT) + this.logger.fatal("OptiFine detected. Use of ModernFix with OptiFine is not supported due to its impact on launch time and breakage of Forge features."); + FastAccessTransformerList.attemptReplace(); DFUBlaster.blastMaps(); diff --git a/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java b/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java index 936ba8c7..d0a50ce1 100644 --- a/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java +++ b/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java @@ -15,8 +15,23 @@ public class ModernFixEarlyConfig { private final Map options = new HashMap<>(); + public static final boolean OPTIFINE_PRESENT; + + static { + boolean hasOfClass = false; + try { + Class.forName("optifine.OptiFineTransformationService"); + hasOfClass = true; + } catch(Throwable e) { + } + OPTIFINE_PRESENT = hasOfClass; + } + private static boolean modPresent(String modId) { - return FMLLoader.getLoadingModList().getModFileById(modId) != null; + if(modId.equals("optifine")) + return OPTIFINE_PRESENT; + else + return FMLLoader.getLoadingModList().getModFileById(modId) != null; } private ModernFixEarlyConfig() { @@ -71,11 +86,12 @@ public class ModernFixEarlyConfig { disableIfModPresent("mixin.perf.compress_biome_container", "chocolate", "betterendforge"); disableIfModPresent("mixin.bugfix.mc218112", "performant"); disableIfModPresent("mixin.perf.reuse_datapacks", "tac"); + disableIfModPresent("mixin.launch.class_search_cache", "optifine"); } private void disableIfModPresent(String configName, String... ids) { for(String id : ids) { - if(FMLLoader.getLoadingModList().getModFileById(id) != null) { + if(modPresent(id)) { Option option = this.options.get(configName); if(option != null) option.addModOverride(false, id);