mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Ensure chunk gen tasks return to main thread before completing futures
This commit is contained in:
parent
3ef000597a
commit
4347fa1b85
1 changed files with 10 additions and 1 deletions
|
@ -90,12 +90,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
IChunkAccess ichunkaccess = (IChunkAccess) optional.get();
|
||||
|
||||
if (ichunkaccess.getChunkStatus().b(chunkstatus)) {
|
||||
- CompletableFuture completablefuture1;
|
||||
+ CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture1; // Paper
|
||||
|
||||
if (chunkstatus == ChunkStatus.LIGHT) {
|
||||
completablefuture1 = this.b(playerchunk, chunkstatus);
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
return this.b(playerchunk, chunkstatus);
|
||||
}
|
||||
}
|
||||
- }, this.executor);
|
||||
+ }, this.mainInvokingExecutor); // Paper - optimize chunk status progression without jumping through thread pool
|
||||
+ }, this.mainInvokingExecutor).thenComposeAsync(CompletableFuture::completedFuture, this.mainInvokingExecutor); // Paper - optimize chunk status progression without jumping through thread pool - ensure main
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue