mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-28 12:07:42 +01:00
Reduce code duplication
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
faa289a097
commit
20891070d1
@ -138,20 +138,8 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
|
||||
player.viewEngine.viewerOption.unregister(this);
|
||||
updateOldViewer(player);
|
||||
},
|
||||
this instanceof Player player ? entity -> {
|
||||
// Add viewer
|
||||
if (!Entity.this.viewEngine.viewerOption.predicate(entity) ||
|
||||
!entity.viewEngine.viewableOption.predicate(player)) return;
|
||||
Entity.this.viewEngine.viewerOption.register(entity);
|
||||
entity.viewEngine.viewableOption.register(player);
|
||||
entity.updateNewViewer(player);
|
||||
} : null,
|
||||
this instanceof Player player ? entity -> {
|
||||
// Remove viewer
|
||||
Entity.this.viewEngine.viewerOption.unregister(entity);
|
||||
entity.viewEngine.viewableOption.unregister(player);
|
||||
entity.updateOldViewer(player);
|
||||
} : null);
|
||||
this instanceof Player player ? entity -> entity.viewEngine.viewableOption.addition.accept(player) : null,
|
||||
this instanceof Player player ? entity -> entity.viewEngine.viewableOption.removal.accept(player) : null);
|
||||
protected final Set<Player> viewers = viewEngine.asSet();
|
||||
private final NBTCompound nbtCompound = new NBTCompound();
|
||||
private final Set<Permission> permissions = new CopyOnWriteArraySet<>();
|
||||
|
Loading…
Reference in New Issue
Block a user