2019-12-13 16:22:16 +00:00
|
|
|
From d6f1614afe2775c5b94a7fd8839714a466dd1c97 Mon Sep 17 00:00:00 2001
|
2019-05-29 03:25:08 +00:00
|
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
|
|
Date: Wed, 29 May 2019 04:01:22 +0100
|
|
|
|
Subject: [PATCH] ChunkMapDistance CME
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
2019-12-12 16:20:43 +00:00
|
|
|
index a35f0e18b..8c1945687 100644
|
2019-05-29 03:25:08 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
|
2019-12-12 16:20:43 +00:00
|
|
|
@@ -33,7 +33,7 @@ public abstract class ChunkMapDistance {
|
2019-06-25 01:47:58 +00:00
|
|
|
private final ChunkMapDistance.a e = new ChunkMapDistance.a();
|
|
|
|
private final ChunkMapDistance.b f = new ChunkMapDistance.b(8);
|
|
|
|
private final ChunkMapDistance.c g = new ChunkMapDistance.c(33);
|
2019-07-20 04:01:24 +00:00
|
|
|
- private final Set<PlayerChunk> pendingChunkUpdates = Sets.newHashSet();
|
|
|
|
+ private final java.util.Queue<PlayerChunk> pendingChunkUpdates = new java.util.LinkedList<>(); // PAIL pendingChunkUpdates // Paper - use a queue
|
|
|
|
private final ChunkTaskQueueSorter i;
|
2019-06-25 01:47:58 +00:00
|
|
|
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> j;
|
|
|
|
private final Mailbox<ChunkTaskQueueSorter.b> k;
|
2019-12-12 16:20:43 +00:00
|
|
|
@@ -94,26 +94,12 @@ public abstract class ChunkMapDistance {
|
2019-05-29 03:25:08 +00:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
2019-07-20 04:01:24 +00:00
|
|
|
if (!this.pendingChunkUpdates.isEmpty()) {
|
2019-07-16 22:09:32 +00:00
|
|
|
- // CraftBukkit start
|
|
|
|
- // Iterate pending chunk updates with protection against concurrent modification exceptions
|
2019-07-20 04:01:24 +00:00
|
|
|
- java.util.Iterator<PlayerChunk> iter = this.pendingChunkUpdates.iterator();
|
|
|
|
- int expectedSize = this.pendingChunkUpdates.size();
|
2019-07-16 22:09:32 +00:00
|
|
|
- do {
|
|
|
|
- PlayerChunk playerchunk = iter.next();
|
|
|
|
- iter.remove();
|
|
|
|
- expectedSize--;
|
|
|
|
-
|
2019-07-02 18:50:03 +00:00
|
|
|
- playerchunk.a(playerchunkmap);
|
2019-07-16 22:09:32 +00:00
|
|
|
-
|
|
|
|
- // Reset iterator if set was modified using add()
|
2019-07-20 04:01:24 +00:00
|
|
|
- if (this.pendingChunkUpdates.size() != expectedSize) {
|
|
|
|
- expectedSize = this.pendingChunkUpdates.size();
|
|
|
|
- iter = this.pendingChunkUpdates.iterator();
|
2019-07-16 22:09:32 +00:00
|
|
|
- }
|
|
|
|
- } while (iter.hasNext());
|
|
|
|
- // CraftBukkit end
|
|
|
|
-
|
2019-07-20 04:01:24 +00:00
|
|
|
+ while(!this.pendingChunkUpdates.isEmpty()) {
|
|
|
|
+ this.pendingChunkUpdates.remove().a(playerchunkmap);
|
2019-07-02 18:50:03 +00:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
if (!this.l.isEmpty()) {
|
2019-05-29 03:25:08 +00:00
|
|
|
--
|
2019-12-12 16:20:43 +00:00
|
|
|
2.24.1
|
2019-05-29 03:25:08 +00:00
|
|
|
|