Class ScreenEvent.Opening
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.ScreenEvent
net.neoforged.neoforge.client.event.ScreenEvent.Opening
- All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent
- Enclosing class:
ScreenEvent
public static class ScreenEvent.Opening
extends ScreenEvent
implements net.neoforged.bus.api.ICancellableEvent
Fired before any
Screen
is opened, to allow changing it or preventing it from being opened.
All screen layers on the screen are closed before this event is fired.
This event is cancellable, and does not
.
If this event is cancelled, then the invalid reference
have a result
Screen
shall be prevented from opening and any previous screen
will remain open. However, cancelling this event will not prevent the closing of screen layers which happened before
this event fired.
This event is fired on the main Forge event bus, only on the logical client.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.client.event.ScreenEvent
ScreenEvent.BackgroundRendered, ScreenEvent.CharacterTyped, ScreenEvent.Closing, ScreenEvent.Init, ScreenEvent.KeyPressed, ScreenEvent.KeyReleased, ScreenEvent.MouseButtonPressed, ScreenEvent.MouseButtonReleased, ScreenEvent.MouseDragged, ScreenEvent.MouseScrolled, ScreenEvent.Opening, ScreenEvent.Render, ScreenEvent.RenderInventoryMobEffects
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable Screen
Gets the currently open screen at the time of the event being fired.@Nullable Screen
void
setNewScreen
(Screen newScreen) Sets the new screen to be opened if the event is not cancelled.Methods inherited from class net.neoforged.neoforge.client.event.ScreenEvent
getScreen
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.neoforged.bus.api.ICancellableEvent
isCanceled, setCanceled
-
Field Details
-
currentScreen
-
newScreen
-
-
Constructor Details
-
Opening
-
-
Method Details
-
getCurrentScreen
Gets the currently open screen at the time of the event being fired.May be null if no screen was open.
-
getNewScreen
- Returns:
- The screen that will be opened if the event is not cancelled. May be null.
-
setNewScreen
Sets the new screen to be opened if the event is not cancelled. May be null.
-