mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-20 12:29:40 +00:00
Only return null if job is explicitly cancelled (#251)
This commit is contained in:
1 parent
83cf0801ef
commit
4d39c90ba6
1 file changed
+9
-7
+9
-7
@@ -201,13 +201,15 @@ public class ChunkRenderRebuildTask<T extends ChunkGraphicsState> extends ChunkR
|
||||
|
||||
if(hasMainThreadBlocks) {
|
||||
// Render the other blocks on the main thread
|
||||
try {
|
||||
CompletableFuture.runAsync(() -> this.performMainBuild(cache, buffers, cancellationSource, bounds, renderData, mainThreadBlocks), AngelicaRenderQueue.executor()).get();
|
||||
} catch(InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return null;
|
||||
} catch(ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
var future = CompletableFuture.runAsync(() -> this.performMainBuild(cache, buffers, cancellationSource, bounds, renderData, mainThreadBlocks), AngelicaRenderQueue.executor());
|
||||
while(!future.isDone() && !cancellationSource.isCancelled()) {
|
||||
try {
|
||||
future.get();
|
||||
} catch(InterruptedException e) {
|
||||
// go around and check cancellation
|
||||
} catch(ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
// Check if cancellation happened during that, so we don't render an incomplete chunk
|
||||
if(cancellationSource.isCancelled()) return null;
|
||||
|
||||
Reference in new issue
Block a user