Merge 1.19.4 into 1.20

This commit is contained in:
embeddedt 2023-07-07 20:23:42 -04:00
commit e56898fff4
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() { 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

@ -71,7 +71,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();
} }
@ -92,8 +93,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();
} }
} }

View File

@ -34,6 +34,21 @@ public class ModernFixMixinPlugin implements IMixinConfigPlugin {
this.logger.info("Loaded configuration file for ModernFix: {} options available, {} override(s) found", this.logger.info("Loaded configuration file for ModernFix: {} options available, {} override(s) found",
config.getOptionCount(), config.getOptionOverrideCount()); 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) 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."); 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; 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(); return option.isEnabled();
} }
@Override @Override