File tree Expand file tree Collapse file tree 2 files changed +27
-7
lines changed
src/main/java/com/cleanroommc/modularui/screen Expand file tree Collapse file tree 2 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -167,24 +167,43 @@ public void onResize(int width, int height) {
167167 }
168168 }
169169
170+ /**
171+ * Called when another screen opens, but this screen is still open or this screen an overlay is and the gui screen parent closes.
172+ */
173+ @ ApiStatus .Internal
170174 public final void onCloseParent () {
171- if (this .panelManager .closeAll ()) {
172- onClose ();
173- }
175+ this .panelManager .closeAll ();
174176 }
175177
178+ /**
179+ * Called after the screen is opened, but before the screen and all widgets are resized.
180+ */
176181 @ ApiStatus .OverrideOnly
177- public void onOpen () {
178- }
182+ public void onOpen () {}
179183
184+ /**
185+ * Called after the last panel (always the main panel) closes which closes the screen.
186+ */
180187 @ ApiStatus .OverrideOnly
181- public void onClose () {
182- }
188+ public void onClose () {}
183189
190+ /**
191+ * Gently closes all open panels and this screen. If NeverEnoughAnimations is installed and open/close is enabled this will play the
192+ * animation for all open panels and closes the screen after the animation is finished.
193+ */
184194 public void close () {
185195 close (false );
186196 }
187197
198+ /**
199+ * Closes all open panels and this screen. If {@code force} is true, the screen will immediately close and skip all lifecycle steps to
200+ * properly close panels and this screen. <b>This should be avoided in most situations</b>.
201+ * If {@code force} is false, the panels are gently closed. If NeverEnoughAnimations is installed and open/close is enabled this will
202+ * play the animation for all open panels and closes the screen after the animation is finished.
203+ *
204+ * @param force true if the screen should be closed immediately without going through remaining lifecycle steps.
205+ */
206+ @ ApiStatus .Internal
188207 public void close (boolean force ) {
189208 if (isActive ()) {
190209 if (force ) {
Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ public boolean closeAll() {
176176 if (this .state .isOpen ) {
177177 this .panels .forEach (this ::finalizePanel );
178178 setState (State .CLOSED );
179+ this .screen .onClose ();
179180 return true ;
180181 }
181182 return false ;
You can’t perform that action at this time.
0 commit comments