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 have a result.
 If this event is cancelled, then the 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 SummaryNested classes/interfaces inherited from class net.neoforged.neoforge.client.event.ScreenEventScreenEvent.BackgroundRendered, ScreenEvent.CharacterTyped, ScreenEvent.Closing, ScreenEvent.Init, ScreenEvent.KeyPressed, ScreenEvent.KeyReleased, ScreenEvent.MouseButtonPressed, ScreenEvent.MouseButtonReleased, ScreenEvent.MouseDragged, ScreenEvent.MouseScrolled, ScreenEvent.Opening, ScreenEvent.Render, ScreenEvent.RenderInventoryMobEffectsNested classes/interfaces inherited from class net.neoforged.bus.api.Eventnet.neoforged.bus.api.Event.HasResult, net.neoforged.bus.api.Event.Result
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescription@Nullable ScreenGets the currently open screen at the time of the event being fired.@Nullable ScreenvoidsetNewScreen(Screen newScreen) Sets the new screen to be opened if the event is not cancelled.Methods inherited from class net.neoforged.neoforge.client.event.ScreenEventgetScreenMethods inherited from class net.neoforged.bus.api.EventgetResult, hasResult, setResultMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.neoforged.bus.api.ICancellableEventisCanceled, setCanceled
- 
Field Details- 
currentScreen
- 
newScreen
 
- 
- 
Constructor Details- 
Opening
 
- 
- 
Method Details- 
getCurrentScreenGets 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.
 
- 
setNewScreenSets the new screen to be opened if the event is not cancelled. May be null.
 
-