more patches added back

This commit is contained in:
Jake Potrebic
2021-06-15 23:25:38 -07:00
parent dfd56ee93f
commit 5624ad3c68
5 changed files with 821 additions and 13 deletions

View File

@@ -401,13 +401,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public Stream<ServerPlayer> getPlayers(ChunkPos chunkPos, boolean onlyOnWatchDistanceEdge) {
- return this.playerMap.getPlayers(chunkPos.toLong()).filter((entityplayer) -> {
- int i = ChunkMap.checkerboardDistance(chunkPos, entityplayer, true);
-
- return i > this.viewDistance ? false : !onlyOnWatchDistanceEdge || i == this.viewDistance;
- });
+ // Paper start - per player view distance
+ // there can be potential desync with player's last mapped section and the view distance map, so use the
+ // view distance map here.
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> inRange = this.playerViewDistanceBroadcastMap.getObjectsInRange(chunkPos);
- return i > this.viewDistance ? false : !onlyOnWatchDistanceEdge || i == this.viewDistance;
- });
+
+ if (inRange == null) {
+ return Stream.empty();
+ }