Class ScreenEvent.Init
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.ScreenEvent
net.neoforged.neoforge.client.event.ScreenEvent.Init
- Direct Known Subclasses:
ScreenEvent.Init.Post
,ScreenEvent.Init.Pre
- Enclosing class:
ScreenEvent
Fired when a screen is being initialized.
See the two subclasses for listening before and after the initialization.
Listeners added through this event may also be marked as renderable or narratable, if they inherit from
Renderable
and NarratableEntry
respectively.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Fired after the screen's overridable initialization method is called.static class
Fired before the screen's overridable initialization method is fired.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
Modifier and TypeFieldDescriptionprivate final Consumer
<GuiEventListener> private final List
<GuiEventListener> private final Consumer
<GuiEventListener> -
Constructor Summary
ModifierConstructorDescriptionprotected
Init
(Screen screen, List<GuiEventListener> listenerList, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(GuiEventListener listener) Adds the givenGuiEventListener
to the screen.Returns unmodifiable view of list of event listeners on the screen.void
removeListener
(GuiEventListener listener) Removes the givenGuiEventListener
from the screen.Methods inherited from class net.neoforged.neoforge.client.event.ScreenEvent
getScreen
-
Field Details
-
add
-
remove
-
listenerList
-
-
Constructor Details
-
Init
@Internal protected Init(Screen screen, List<GuiEventListener> listenerList, Consumer<GuiEventListener> add, Consumer<GuiEventListener> remove)
-
-
Method Details
-
getListenersList
Returns unmodifiable view of list of event listeners on the screen.- Returns:
- unmodifiable view of list of event listeners on the screen
-
addListener
Adds the givenGuiEventListener
to the screen.- Parameters:
listener
- the listener to add
-
removeListener
Removes the givenGuiEventListener
from the screen.- Parameters:
listener
- the listener to remove
-