mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 08:59:23 +00:00
* Update Leaf API patches to 1.20.5 * Updated Upstream (Purpur API) * Some server patches work * Update 1.20.6 * Some server patches work * Some some server patches work * 0oO0oO0oOo * iI1IiI1i|!il| * Updated Upstream (Gale/Purpur) * Server patches work * Updated Upstream (Gale)
26 lines
1.3 KiB
Diff
26 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
|
Date: Tue, 2 Jan 2024 21:13:53 -0500
|
|
Subject: [PATCH] Faster sequencing of futures for chunk structure gen
|
|
|
|
Replace `thenApply` with `thenCompose`. Once one task is completed then the next task starts immediately,
|
|
to prevent blocking threads while waiting to complete all tasks
|
|
|
|
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
|
index 0bd367235f80c1f0d319a6aa5130d82ad82d895c..194a883e028d1dff82516da0a890497d6aa3aeef 100644
|
|
--- a/src/main/java/net/minecraft/Util.java
|
|
+++ b/src/main/java/net/minecraft/Util.java
|
|
@@ -459,7 +459,11 @@ public class Util {
|
|
return futures.get(0).thenApply(List::of);
|
|
} else {
|
|
CompletableFuture<Void> completableFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
- return completableFuture.thenApply(void_ -> futures.stream().map(CompletableFuture::join).toList());
|
|
+ // Leaf start - Faster sequencing of futures for chunk structure gen
|
|
+ return completableFuture.thenCompose(void_ ->
|
|
+ CompletableFuture.supplyAsync(() ->
|
|
+ futures.stream().map(CompletableFuture::join).toList()));
|
|
+ // Leaf end
|
|
}
|
|
}
|
|
|