Log all option overrides once at startup rather than per mixin

This commit is contained in:
embeddedt 2023-07-07 20:23:10 -04:00
parent f27d6e154c
commit f3a2ca73e8
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -34,6 +34,21 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
this.logger.info("Loaded configuration file for ModernFix: {} options available, {} override(s) found",
config.getOptionCount(), config.getOptionOverrideCount());
config.getOptionMap().values().forEach(option -> {
if (option.isOverridden()) {
String source = "[unknown]";
if (option.isUserDefined()) {
source = "user configuration";
} else if (option.isModDefined()) {
source = "mods [" + String.join(", ", option.getDefiningMods()) + "]";
}
this.logger.warn("Option '{}' overriden (by {}) to '{}'", option.getName(),
source, option.isEnabled());
}
});
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.");
@ -87,24 +102,6 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
return false;
}
if (option.isOverridden()) {
String source = "[unknown]";
if (option.isUserDefined()) {
source = "user configuration";
} else if (option.isModDefined()) {
source = "mods [" + String.join(", ", option.getDefiningMods()) + "]";
}
if (option.isEnabled()) {
this.logger.warn("Force-enabling mixin '{}' as rule '{}' (added by {}) enables it", mixin,
option.getName(), source);
} else {
this.logger.warn("Force-disabling mixin '{}' as rule '{}' (added by {}) disables it and children", mixin,
option.getName(), source);
}
}
return option.isEnabled();
}
@Override