papermc/Spigot-Server-Patches/0395-ChunkMapDistance-CME.patch

40 lines
1.5 KiB
Diff
Raw Normal View History

2019-07-05 02:23:33 +00:00
From 1766a8a8d59788875641888455fa5e44b0e1aaf3 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-07-05 02:23:33 +00:00
index ed4e8d69ca..a116826490 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-07-05 02:23:33 +00:00
@@ -36,7 +36,7 @@ public abstract class ChunkMapDistance {
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);
- private final Set<PlayerChunk> h = Sets.newHashSet();
2019-07-05 02:23:33 +00:00
+ private final java.util.Queue<PlayerChunk> h = new java.util.LinkedList<>(); // Paper - use a queue
private final PlayerChunk.c i;
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> j;
private final Mailbox<ChunkTaskQueueSorter.b> k;
2019-07-05 02:23:33 +00:00
@@ -98,11 +98,12 @@ public abstract class ChunkMapDistance {
2019-05-29 03:25:08 +00:00
;
}
+ // Paper start
if (!this.h.isEmpty()) {
- this.h.forEach((playerchunk) -> {
- playerchunk.a(playerchunkmap);
- });
- this.h.clear();
+ while(!this.h.isEmpty()) {
+ this.h.remove().a(playerchunkmap);
+ }
+ // Paper end
return true;
} else {
if (!this.l.isEmpty()) {
2019-05-29 03:25:08 +00:00
--
2.22.0
2019-05-29 03:25:08 +00:00