[1.16] Do not sync load POI data (#3996)

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
Spottedleaf 2020-07-24 20:28:57 -07:00
parent a9e08ce8c6
commit 1b248d842f

View file

@ -3247,15 +3247,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (ioThrowable != null) {
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(ioThrowable);
+ }
+ chunkHolder.tasks.forEach(Runnable::run);
+ // Paper end
- if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings
- boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8);
+ if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async
+ this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData);
+ chunkHolder.tasks.forEach(Runnable::run);
+ // Paper end
- if (flag) {
- ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound);
+ if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async
+
+ if (true) {
+ ProtoChunk protochunk = chunkHolder.protoChunk;
@ -3410,12 +3412,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end
+ synchronized (this) { // Paper - async io
+ RegionFile regionFile = this.regionFileCache.getFile(chunkPos, true);
- ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z);
+
+ if (regionFile == null || !regionFile.chunkExists(chunkPos)) {
+ return null;
+ }
+
- ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z);
+ ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z);
- if (status != null) {