Merge 1.16 into 1.18

This commit is contained in:
embeddedt 2023-07-07 20:23:39 -04:00
commit 8fd31f3190
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
3 changed files with 23 additions and 22 deletions

View File

@ -70,7 +70,8 @@ public class ModernFix {
public void onServerStarted() {
if(ModernFixPlatformHooks.isDedicatedServer()) {
float gameStartTime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
ModernFix.LOGGER.warn("Dedicated server took " + gameStartTime + " seconds to load");
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.measure_time.ServerLoad"))
ModernFix.LOGGER.warn("Dedicated server took " + gameStartTime + " seconds to load");
ModernFixPlatformHooks.onLaunchComplete();
}
ClassInfoManager.clear();

View File

@ -71,7 +71,8 @@ public class ModernFixClient {
worldLoadStartTime = System.nanoTime();
} else if (openingScreen instanceof TitleScreen && gameStartTimeSeconds < 0) {
gameStartTimeSeconds = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f;
ModernFix.LOGGER.warn("Game took " + gameStartTimeSeconds + " seconds to start");
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.measure_time.GameLoad"))
ModernFix.LOGGER.warn("Game took " + gameStartTimeSeconds + " seconds to start");
ModernFixPlatformHooks.onLaunchComplete();
ClassInfoManager.clear();
}
@ -92,8 +93,10 @@ public class ModernFixClient {
&& Minecraft.getInstance().player != null
&& numRenderTicks++ >= 10) {
float timeSpentLoading = ((float)(System.nanoTime() - worldLoadStartTime) / 1000000000f);
ModernFix.LOGGER.warn("Time from main menu to in-game was " + timeSpentLoading + " seconds");
ModernFix.LOGGER.warn("Total time to load game and open world was " + (timeSpentLoading + gameStartTimeSeconds) + " seconds");
if(ModernFixMixinPlugin.instance.isOptionEnabled("feature.measure_time.WorldLoad")) {
ModernFix.LOGGER.warn("Time from main menu to in-game was " + timeSpentLoading + " seconds");
ModernFix.LOGGER.warn("Total time to load game and open world was " + (timeSpentLoading + gameStartTimeSeconds) + " seconds");
}
resetWorldLoadStateMachine();
}
}

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