mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-17 02:34:30 +01:00
Improve Priority handling of neighbor chunks
Restores vanilla like behavior where neighbor chunks have less priority than the source chunk. This resolves the issue where teleporting sometimes has the chunk your arriving in slow to send. Also improves light tasks to always process tasks when tasks from the current priority level are collected instead of bundling them.
This commit is contained in:
parent
d793efc858
commit
976c295514
2 changed files with 7 additions and 7 deletions
Spigot-Server-Patches
|
@ -687,7 +687,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ private int getNeighborsPriority() {
|
||||
+ return neighborPriorities.isEmpty() ? getMyPriority() : getDemandedPriority();
|
||||
+ return (neighborPriorities.isEmpty() ? getMyPriority() : getDemandedPriority()) + 1;
|
||||
+ }
|
||||
+
|
||||
+ public void onNeighborRequest(PlayerChunk neighbor, ChunkStatus status) {
|
||||
|
|
|
@ -1098,7 +1098,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ this.priorityChanges.add(() -> {
|
||||
+ ChunkLightQueue remove = this.buckets[currentPriority].remove(pair);
|
||||
+ if (remove != null) {
|
||||
+ ChunkLightQueue existing = this.buckets[priority].put(pair, remove);
|
||||
+ ChunkLightQueue existing = this.buckets[Math.max(1, priority)].put(pair, remove);
|
||||
+ if (existing != null) {
|
||||
+ remove.pre.addAll(existing.pre);
|
||||
+ remove.post.addAll(existing.post);
|
||||
|
@ -1151,12 +1151,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ boolean hasWork = false;
|
||||
+ Long2ObjectLinkedOpenHashMap<ChunkLightQueue>[] buckets = this.buckets;
|
||||
+ int lowestPriority = 0;
|
||||
+ while (lowestPriority < MAX_PRIORITIES && !isEmpty()) {
|
||||
+ Long2ObjectLinkedOpenHashMap<ChunkLightQueue> bucket = buckets[lowestPriority];
|
||||
+ int priority = 0;
|
||||
+ while (priority < MAX_PRIORITIES && !isEmpty()) {
|
||||
+ Long2ObjectLinkedOpenHashMap<ChunkLightQueue> bucket = buckets[priority];
|
||||
+ if (bucket.isEmpty()) {
|
||||
+ lowestPriority++;
|
||||
+ if (hasWork && lowestPriority <= 5) {
|
||||
+ priority++;
|
||||
+ if (hasWork) {
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue