mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-05 23:11:36 +01:00
Properly remove manual viewers
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
b637cd3059
commit
e53c0a68fb
@ -878,6 +878,7 @@ public class Entity implements Viewable, Tickable, TagHandler, PermissionHandler
|
||||
private void removeFromInstance(Instance instance) {
|
||||
EventDispatcher.call(new RemoveEntityFromInstanceEvent(instance, this));
|
||||
instance.getEntityTracker().unregister(this, position, trackingTarget, trackingUpdate);
|
||||
this.viewEngine.forManuals(this::removeViewer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,6 +77,12 @@ public final class ViewEngine {
|
||||
}
|
||||
}
|
||||
|
||||
public void forManuals(@NotNull Consumer<Player> consumer) {
|
||||
synchronized (mutex) {
|
||||
this.manualViewers.forEach(consumer);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasPredictableViewers() {
|
||||
// Verify if this entity's viewers can be predicted from surrounding entities
|
||||
synchronized (mutex) {
|
||||
|
Loading…
Reference in New Issue
Block a user