From 58bff62b2dc68da958f2e90371582a13aa3c9355 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 6 Dec 2016 22:05:58 +1100 Subject: [PATCH] SPIGOT-2891: Remove chunks if first check is false Minecraft does double checking for synchronous generation, but since we generate chunks asynchronously we are required to check the first condition also in case the chunk was loaded between ticks. We leave the other logic to be cleaned up by the loops below. --- nms-patches/PlayerChunkMap.patch | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch index 6ec531c9da..37c4c4744d 100644 --- a/nms-patches/PlayerChunkMap.patch +++ b/nms-patches/PlayerChunkMap.patch @@ -19,7 +19,19 @@ public PlayerChunkMap(WorldServer worldserver) { this.world = worldserver; -@@ -231,6 +236,16 @@ +@@ -169,7 +174,11 @@ + break; + } + } ++ // CraftBukkit start - SPIGOT-2891: remove once chunk has been provided ++ } else { ++ iterator1.remove(); + } ++ // CraftBukkit end + } + } + +@@ -231,6 +240,16 @@ return playerchunk; } @@ -36,7 +48,7 @@ public void flagDirty(BlockPosition blockposition) { int i = blockposition.getX() >> 4; int j = blockposition.getZ() >> 4; -@@ -249,12 +264,22 @@ +@@ -249,12 +268,22 @@ entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; @@ -60,7 +72,7 @@ this.managedPlayers.add(entityplayer); this.e(); } -@@ -298,11 +323,14 @@ +@@ -298,11 +327,14 @@ int j1 = i - k; int k1 = j - l; @@ -76,7 +88,7 @@ } if (!this.a(l1 - j1, i2 - k1, i, j, i1)) { -@@ -318,6 +346,13 @@ +@@ -318,6 +350,13 @@ entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; this.e(); @@ -90,7 +102,7 @@ } } } -@@ -402,4 +437,47 @@ +@@ -402,4 +441,47 @@ } }