mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-29 04:28:21 +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);
|
player.viewEngine.viewerOption.unregister(this);
|
||||||
updateOldViewer(player);
|
updateOldViewer(player);
|
||||||
},
|
},
|
||||||
this instanceof Player player ? entity -> {
|
this instanceof Player player ? entity -> entity.viewEngine.viewableOption.addition.accept(player) : null,
|
||||||
// Add viewer
|
this instanceof Player player ? entity -> entity.viewEngine.viewableOption.removal.accept(player) : null);
|
||||||
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);
|
|
||||||
protected final Set<Player> viewers = viewEngine.asSet();
|
protected final Set<Player> viewers = viewEngine.asSet();
|
||||||
private final NBTCompound nbtCompound = new NBTCompound();
|
private final NBTCompound nbtCompound = new NBTCompound();
|
||||||
private final Set<Permission> permissions = new CopyOnWriteArraySet<>();
|
private final Set<Permission> permissions = new CopyOnWriteArraySet<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user