Clears the queue and discards all the active SeedQueueEntry's. Also clears any other resources like caches and the Wall Screen WorldRenderers.
()
| 374 | * Also clears any other resources like caches and the Wall Screen WorldRenderers. |
| 375 | */ |
| 376 | private static void clear() { |
| 377 | LOGGER.info("Clearing SeedQueue..."); |
| 378 | |
| 379 | Screen screen = MinecraftClient.getInstance().currentScreen; |
| 380 | MinecraftClient.getInstance().setScreenAndRender(new SaveLevelScreen(TextUtil.translatable("seedqueue.menu.clearing"))); |
| 381 | |
| 382 | synchronized (LOCK) { |
| 383 | if (currentEntry != null && !currentEntry.isLoaded()) { |
| 384 | currentEntry.discard(); |
| 385 | } |
| 386 | currentEntry = null; |
| 387 | } |
| 388 | |
| 389 | SEED_QUEUE.forEach(SeedQueueEntry::discard); |
| 390 | |
| 391 | while (!SEED_QUEUE.isEmpty()) { |
| 392 | ((MinecraftClientAccessor) MinecraftClient.getInstance()).seedQueue$render(false); |
| 393 | SEED_QUEUE.removeIf(entry -> entry.getServer().isStopping()); |
| 394 | } |
| 395 | |
| 396 | SeedQueueExecutorWrapper.shutdownExecutors(); |
| 397 | SeedQueueWallScreen.clearWorldRenderers(); |
| 398 | ModCompat.worldpreview$clearFramebufferPool(); |
| 399 | ModCompat.sodium$clearShaderCache(); |
| 400 | ModCompat.sodium$clearBuildBufferPool(); |
| 401 | System.gc(); |
| 402 | |
| 403 | MinecraftClient.getInstance().openScreen(screen); |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * @return True if there is a running {@link SeedQueueThread}. |
no test coverage detected