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