Readd chunk priority patch, including many chunk system fixes from tuinity (#6488)

This commit is contained in:
Spottedleaf 2021-08-25 19:16:27 -07:00 committed by GitHub
parent 3773df24ce
commit ba4cf68774
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
176 changed files with 1055 additions and 480 deletions

View file

@ -3079,7 +3079,7 @@ index e9d2034f0753670c2ce69cc93c7e98e89af65c87..2b62f4664f439808661d559dc99762bf
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401efca995293 100644
index 9591f50922343283597bad6d9ac17c175d8ae230..48c876381d75c66f24d59bd2c415dd7de293afee 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -44,6 +44,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
@ -3090,7 +3090,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
public class ServerChunkCache extends ChunkSource {
@@ -66,6 +67,158 @@ public class ServerChunkCache extends ChunkSource {
@@ -66,6 +67,156 @@ public class ServerChunkCache extends ChunkSource {
@Nullable
@VisibleForDebug
private NaturalSpawner.SpawnState lastSpawnState;
@ -3227,9 +3227,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
+
+ try {
+ if (onLoad != null) {
+ chunkMap.callbackExecutor.execute(() -> {
+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback.
+ });
+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback.
+ }
+ } catch (Throwable thr) {
+ if (thr instanceof ThreadDeath) {
@ -3249,7 +3247,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, boolean flag, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<DimensionDataStorage> supplier) {
this.level = world;
@@ -127,6 +280,49 @@ public class ServerChunkCache extends ChunkSource {
@@ -127,6 +278,49 @@ public class ServerChunkCache extends ChunkSource {
this.lastChunk[0] = chunk;
}
@ -3299,7 +3297,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..8513490230f5fae0042f536b69b401ef
@Nullable
@Override
public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) {
@@ -453,7 +649,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -453,7 +647,7 @@ public class ServerChunkCache extends ChunkSource {
}
this.level.getProfiler().popPush("broadcast");