From 056f819cc88974e4eed0be3e674415a2ecbe1329 Mon Sep 17 00:00:00 2001 From: themode Date: Sun, 13 Feb 2022 20:02:06 +0100 Subject: [PATCH] Slightly optimize viewable stream --- src/main/java/net/minestom/server/utils/ViewEngine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/utils/ViewEngine.java b/src/main/java/net/minestom/server/utils/ViewEngine.java index 2caedc349..9471def44 100644 --- a/src/main/java/net/minestom/server/utils/ViewEngine.java +++ b/src/main/java/net/minestom/server/utils/ViewEngine.java @@ -227,11 +227,11 @@ public final class ViewEngine { Stream sharedInstanceStream = shared.stream().>mapMulti((inst, consumer) -> { var ref = inst.getEntityTracker().references(lastPoint, range, target); ref.forEach(consumer); - }).flatMap(Collection::stream); + }).flatMap(Collection::stream).distinct(); result = Stream.concat(result, sharedInstanceStream); } } - return result.distinct(); + return result; } }