Make disabling feature.measure_time also disable game/world load messages

This commit is contained in:
embeddedt 2023-07-07 20:19:08 -04:00
parent 1c0fca8f06
commit f27d6e154c
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
2 changed files with 8 additions and 4 deletions

View File

@ -70,7 +70,8 @@ public class ModernFix {
public void onServerStarted() { public void onServerStarted() {
if(ModernFixPlatformHooks.isDedicatedServer()) { if(ModernFixPlatformHooks.isDedicatedServer()) {
float gameStartTime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000f; 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(); ModernFixPlatformHooks.onLaunchComplete();
} }
ClassInfoManager.clear(); ClassInfoManager.clear();

View File

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