Fail stuck render captures
This commit is contained in:
+8
@@ -28,6 +28,7 @@ import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public final class RenderCatalogClient implements ClientModInitializer {
|
||||
private static final Gson GSON = new Gson();
|
||||
private static final long CAPTURE_TIMEOUT_MILLIS = 120_000L;
|
||||
|
||||
private final List<RenderJob> jobs = new ArrayList<>();
|
||||
private Path outputDir;
|
||||
@@ -213,6 +214,7 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
||||
|
||||
private final class RenderScreen extends Screen {
|
||||
private boolean captureQueued;
|
||||
private long captureQueuedAtMillis;
|
||||
|
||||
private RenderScreen() {
|
||||
super(Component.literal("Rendering renameable items"));
|
||||
@@ -220,10 +222,12 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
||||
|
||||
private void markCaptureQueued() {
|
||||
captureQueued = true;
|
||||
captureQueuedAtMillis = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
private void resetCaptureState() {
|
||||
captureQueued = false;
|
||||
captureQueuedAtMillis = 0L;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -234,6 +238,10 @@ public final class RenderCatalogClient implements ClientModInitializer {
|
||||
if (currentJobIndex < jobs.size()) {
|
||||
Minecraft client = Minecraft.getInstance();
|
||||
RenderJob job = jobs.get(currentJobIndex);
|
||||
if (captureQueued && captureQueuedAtMillis > 0L && System.currentTimeMillis() - captureQueuedAtMillis > CAPTURE_TIMEOUT_MILLIS) {
|
||||
throw new RuntimeException("Timed out waiting for screenshot capture for " + job.outputPath());
|
||||
}
|
||||
|
||||
ItemStack stack = createStack(job);
|
||||
if (stack.isEmpty()) {
|
||||
client.execute(() -> advanceJob());
|
||||
|
||||
Reference in New Issue
Block a user