Don't read neighbour chunk data off disk when converting chunks

Lighting is purged on update anyways, so let's not add more
into the conversion process
This commit is contained in:
Spottedleaf 2021-04-11 02:58:48 -07:00
parent ebaf017f9c
commit 698c758855

View File

@ -18,7 +18,7 @@
import net.minecraft.world.level.levelgen.structure.LegacyStructureDataHandler; import net.minecraft.world.level.levelgen.structure.LegacyStructureDataHandler;
import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.DimensionDataStorage;
@@ -39,27 +45,85 @@ @@ -39,27 +45,86 @@
return this.worker.isOldChunkAround(chunkPos, checkRadius); return this.worker.isOldChunkAround(chunkPos, checkRadius);
} }
@ -26,6 +26,7 @@
- int i = ChunkStorage.getVersion(nbt); - int i = ChunkStorage.getVersion(nbt);
+ // CraftBukkit start + // CraftBukkit start
+ private boolean check(ServerChunkCache cps, int x, int z) { + private boolean check(ServerChunkCache cps, int x, int z) {
+ if (true) return true; // Paper - Perf: this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full"
+ ChunkPos pos = new ChunkPos(x, z); + ChunkPos pos = new ChunkPos(x, z);
+ if (cps != null) { + if (cps != null) {
+ com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); + com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread");
@ -116,7 +117,7 @@
} catch (Exception exception) { } catch (Exception exception) {
CrashReport crashreport = CrashReport.forThrowable(exception, "Updated chunk"); CrashReport crashreport = CrashReport.forThrowable(exception, "Updated chunk");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Updated chunk details"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Updated chunk details");
@@ -70,7 +134,7 @@ @@ -70,7 +135,7 @@
} }
} }
@ -125,7 +126,7 @@
LegacyStructureDataHandler persistentstructurelegacy = this.legacyStructureHandler; LegacyStructureDataHandler persistentstructurelegacy = this.legacyStructureHandler;
if (persistentstructurelegacy == null) { if (persistentstructurelegacy == null) {
@@ -85,7 +149,7 @@ @@ -85,7 +150,7 @@
return persistentstructurelegacy; return persistentstructurelegacy;
} }
@ -134,7 +135,7 @@
CompoundTag nbttagcompound1 = new CompoundTag(); CompoundTag nbttagcompound1 = new CompoundTag();
nbttagcompound1.putString("dimension", worldKey.location().toString()); nbttagcompound1.putString("dimension", worldKey.location().toString());
@@ -108,8 +172,19 @@ @@ -108,8 +173,19 @@
} }
public CompletableFuture<Void> write(ChunkPos chunkPos, Supplier<CompoundTag> nbtSupplier) { public CompletableFuture<Void> write(ChunkPos chunkPos, Supplier<CompoundTag> nbtSupplier) {