boolean (@NotNull ModalityState otherState) { if (otherState == this || otherState == ModalityState.any()) return false; if (myModalEntities.isEmpty()) return false; // I have entity which is absent in anotherState return !((ModalityStateEx)otherState).myModalEntities.containsAll(myModalEntities, entity -> !ourTransparentEntities.contains(entity)); }