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
parent 7a51a16318
commit 4355a3ac96
20 changed files with 1890 additions and 119 deletions

View File

@@ -29,8 +29,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -0,0 +0,0 @@ public class ChunkHolder {
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
}
// Paper end
this.oldTicketLevel = this.ticketLevel;
+ //chunkMap.level.getChunkSource().getLightEngine().queue.changePriority(pos.toLong(), this.queueLevel, priority); // Paper // Restore this in chunk priority later?
// CraftBukkit start
@@ -167,15 +167,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ private static final int MAX_PRIORITIES = ChunkMap.MAX_CHUNK_DISTANCE + 2;
+
+ private boolean isChunkLightStatus(long pair) {
+ ChunkHolder playerChunk = playerChunkMap.getVisibleChunkIfPresent(pair);
+ if (playerChunk == null) {
+ return false;
+ }
+ ChunkStatus status = ChunkHolder.getStatus(playerChunk.getTicketLevel());
+ return status != null && status.isOrAfter(ChunkStatus.LIGHT);
+ }
+
+ static class ChunkLightQueue {
+ public boolean shouldFastUpdate;
+ java.util.ArrayDeque<Runnable> pre = new java.util.ArrayDeque<Runnable>();
@@ -341,11 +332,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ IntSupplier prioritySupplier = playerChunkMap.getChunkQueueLevel(pair);
+ boolean[] skippedPre = {false};
+ this.queue.addChunk(pair, prioritySupplier, Util.name(() -> {
+ if (!isChunkLightStatus(pair)) {
+ future.complete(chunk);
+ skippedPre[0] = true;
+ return;
+ }
+ // Paper end
LevelChunkSection[] levelChunkSections = chunk.getSections();