minecraft-src/com/mojang/blaze3d/platform/ClientShutdownWatchdog.java
2025-07-04 02:49:36 +03:00

30 lines
901 B
Java

package com.mojang.blaze3d.platform;
import java.io.File;
import java.time.Duration;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.CrashReport;
import net.minecraft.client.Minecraft;
import net.minecraft.server.dedicated.ServerWatchdog;
@Environment(EnvType.CLIENT)
public class ClientShutdownWatchdog {
private static final Duration CRASH_REPORT_PRELOAD_LOAD = Duration.ofSeconds(15L);
public static void startShutdownWatchdog(File file, long threadId) {
Thread thread = new Thread(() -> {
try {
Thread.sleep(CRASH_REPORT_PRELOAD_LOAD);
} catch (InterruptedException var4) {
return;
}
CrashReport crashReport = ServerWatchdog.createWatchdogCrashReport("Client shutdown", threadId);
Minecraft.saveReport(file, crashReport);
});
thread.setDaemon(true);
thread.setName("Client shutdown watchdog");
thread.start();
}
}