28 lines
1.3 KiB
Diff
28 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: PureGero <puregero@gmail.com>
|
|
Date: Thu, 27 Jan 2022 22:43:56 +1000
|
|
Subject: [PATCH] Run tasks while we wait for the entity storage worker to
|
|
close
|
|
|
|
Original license: GPLv3
|
|
Original project: https://github.com/MultiPaper/MultiPaper
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
|
index 2bc0384728f89b7c64a8beec78a1b77dc063d37b..513ba9199a1361e678e0146e1ca36af9e42ce3dd 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java
|
|
@@ -122,7 +122,12 @@ public class EntityStorage implements EntityPersistentStorage<Entity> {
|
|
|
|
@Override
|
|
public void flush(boolean sync) {
|
|
- this.worker.synchronize(sync).join();
|
|
+ // MultiPaper start - Run tasks while we wait for the entity storage worker to close
|
|
+ CompletableFuture<Void> completableFuture = this.worker.synchronize(sync);
|
|
+ if (!completableFuture.isDone()) {
|
|
+ level.chunkSource.mainThreadProcessor.managedBlock(completableFuture::isDone);
|
|
+ }
|
|
+ // MultiPaper end
|
|
this.entityDeserializerQueue.runAll();
|
|
}
|
|
|