mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-31 21:48:08 +01:00
Player#refreshVisibleEntities cleanup
This commit is contained in:
parent
cd0ea0c0c2
commit
748e3d7b39
@ -1640,18 +1640,17 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
|
||||
final float maximalDistance = entityViewDistance * Chunk.CHUNK_SECTION_SIZE;
|
||||
|
||||
// Manage already viewable entities
|
||||
this.viewableEntities.forEach(entity -> {
|
||||
final double distance = entity.getDistance(this);
|
||||
if (distance > maximalDistance) {
|
||||
// Entity shouldn't be viewable anymore
|
||||
if (isAutoViewable()) {
|
||||
entity.removeViewer(this);
|
||||
}
|
||||
if (entity instanceof Player && entity.isAutoViewable()) {
|
||||
removeViewer((Player) entity);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.viewableEntities.stream()
|
||||
.filter(entity -> entity.getDistance(this) > maximalDistance)
|
||||
.forEach(entity -> {
|
||||
// Entity shouldn't be viewable anymore
|
||||
if (isAutoViewable()) {
|
||||
entity.removeViewer(this);
|
||||
}
|
||||
if (entity instanceof Player && entity.isAutoViewable()) {
|
||||
removeViewer((Player) entity);
|
||||
}
|
||||
});
|
||||
|
||||
// Manage entities in unchecked chunks
|
||||
EntityUtils.forEachRange(instance, newChunk.toPosition(), entityViewDistance, entity -> {
|
||||
|
Loading…
Reference in New Issue
Block a user