Paper/Spigot-Server-Patches/0397-ChunkMapDistance-CME.patch
Spottedleaf 5c7081fecc Update upstream & fix some chunk related issues (#2177)
* Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories

CraftBukkit Changes:
4090d01f SPIGOT-5047: Correct slot types for 1.14 inventories
e8c08362 SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.
d445af3b SPIGOT-5067: Add item meta for 1.14 spawn eggs

* Bring Chunk load checks in-line with spigot

As of the last upstream merge spigot now checks ticket level status
when returning loaded chunks for a world from api. Now our checks
will respect that decision.

* Fix spawn ticket levels

Vanilla would keep the inner chunks of spawn available for ticking,
however my changes made all chunks non-ticking. Resolve by changing
ticket levels for spawn chunks inside the border to respect this
behavior.


* Make World#getChunkIfLoadedImmediately return only entity ticking chunks

Mojang appears to be using chunks with level > 33 (non-ticking chunks)
as cached chunks and not actually loaded chunks.

* Bring all loaded checks in line with spigot

Loaded chunks must be at least border  chunks, or level <= 33
2019-06-14 03:27:40 +01:00

38 lines
1.5 KiB
Diff

From d81c8032d944ab5e3e875af8eb18f219ab70f4bd Mon Sep 17 00:00:00 2001
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
index ba4b9fa59c..d3c2ad3c40 100644
--- a/src/main/java/net/minecraft/server/ChunkMapDistance.java
+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java
@@ -39,7 +39,7 @@ public abstract class ChunkMapDistance {
private int entitydistance;
private final ChunkMapDistance.b i = new ChunkMapDistance.b(8);
private final ChunkMapDistance.d j = new ChunkMapDistance.d(33);
- private final Set<PlayerChunk> k = Sets.newHashSet();
+ private Set<PlayerChunk> k = Sets.newHashSet(); // Paper - -final
private final PlayerChunk.c l;
private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> m;
private final Mailbox<ChunkTaskQueueSorter.b> n;
@@ -117,8 +117,12 @@ public abstract class ChunkMapDistance {
;
}
- if (!this.k.isEmpty()) {
- this.k.forEach((playerchunk) -> {
+ // Paper start
+ Set<PlayerChunk> currentPending = this.k;
+ this.k = Sets.newHashSet();
+ if (!currentPending.isEmpty()) {
+ currentPending.forEach((playerchunk) -> {
+ // Paper end
playerchunk.a(playerchunkmap);
});
this.k.clear();
--
2.21.0