mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-27 10:23:52 -07:00
Ensure chunk gen tasks return to main thread before completing futures
This commit is contained in:
@@ -90,12 +90,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@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 {
|
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||||
return this.b(playerchunk, chunkstatus);
|
return this.b(playerchunk, chunkstatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
- }, this.executor);
|
- }, 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user