Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More accurate load time #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/main/java/club/sk1er/patcher/Patcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import club.sk1er.patcher.screen.render.overlay.OverlayHandler;
import club.sk1er.patcher.screen.render.overlay.metrics.MetricsRenderer;
import club.sk1er.patcher.screen.render.title.TitleFix;
import club.sk1er.patcher.tweaker.PatcherTweaker;
import club.sk1er.patcher.util.chat.ChatHandler;
import club.sk1er.patcher.util.enhancement.EnhancementManager;
import club.sk1er.patcher.util.enhancement.ReloadListener;
Expand Down Expand Up @@ -173,13 +172,6 @@ public void onLoadComplete(FMLLoadCompleteEvent event) {
this.detectIncompatibilities(activeModList, notifications);
this.detectReplacements(activeModList, notifications);

long time = (System.currentTimeMillis() - PatcherTweaker.clientLoadTime) / 1000L;
if (PatcherConfig.startupNotification) {
notifications.push("Minecraft Startup", "Minecraft started in " + time + " seconds.");
}

logger.info("Minecraft started in {} seconds.", time);

//noinspection ConstantConditions
if (!ForgeVersion.mcVersion.equals("1.8.9") || ForgeVersion.getVersion().contains("2318")) return;
notifications.push("Patcher", "Outdated Forge has been detected (" + ForgeVersion.getVersion() + "). " +
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/club/sk1er/patcher/screen/PatcherMenuEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import club.sk1er.patcher.mixins.accessors.GuiMainMenuAccessor;
import club.sk1er.patcher.screen.disconnect.SmartDisconnectScreen;
import club.sk1er.patcher.screen.quit.ConfirmQuitScreen;
import club.sk1er.patcher.tweaker.PatcherTweaker;
import gg.essential.api.EssentialAPI;
import gg.essential.api.config.EssentialConfig;
import gg.essential.elementa.ElementaVersion;
Expand Down Expand Up @@ -32,6 +33,7 @@

public class PatcherMenuEditor {
private boolean tripped = false;
private boolean isFirstLaunch = true;

private final Minecraft mc = Minecraft.getMinecraft();
private final int[] sequence = new int[]{
Expand Down Expand Up @@ -76,6 +78,14 @@ public void openMenu(GuiScreenEvent.InitGuiEvent.Post event) {
final int height = gui.height;

if (gui instanceof GuiMainMenu) {
if (isFirstLaunch) {
long time = (System.currentTimeMillis() - PatcherTweaker.clientLoadTime);
if (PatcherConfig.startupNotification) {
EssentialAPI.getNotifications().push("Minecraft Startup", "Minecraft started in " + time / 1000L + " seconds.");
}
Patcher.instance.getLogger().info("Minecraft started in {}ms.", time);
isFirstLaunch = false;
}
if (PatcherConfig.cleanMainMenu) {
realmsButton = ((GuiMainMenuAccessor) gui).getRealmsButton();
for (GuiButton button : mcButtonList) {
Expand Down
Loading