Merge remote-tracking branch 'origin/main' into 1.18
This commit is contained in:
commit
a60f9ffc61
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,23 @@ public class ModernFixEarlyConfig {
|
|||
|
||||
private final Map<String, Option> 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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user