Class ScreenKeyboardEvents

java.lang.Object
net.fabricmc.fabric.api.client.screen.v1.ScreenKeyboardEvents

@Environment(CLIENT) public final class ScreenKeyboardEvents extends Object
Events related to use of the keyboard in a Screen.

All of these events work on top of a specific screen instance. Subscriptions will only last as long as the screen itself, they'll disappear once the screen gets refreshed, closed or replaced. Use ScreenEvents.BEFORE_INIT to register the desired events every time it is necessary.

Events are fired in the following order:

AllowX -> BeforeX -> AfterX
If the result of the Allow event is false, then Before and After are not called.
See Also:
  • Method Details

    • allowKeyPress

      public static Event<ScreenKeyboardEvents.AllowKeyPress> allowKeyPress(net.minecraft.client.gui.screen.Screen screen)
      An event that checks if a key press should be allowed.
      Returns:
      the event
    • beforeKeyPress

      public static Event<ScreenKeyboardEvents.BeforeKeyPress> beforeKeyPress(net.minecraft.client.gui.screen.Screen screen)
      An event that is called before a key press is processed for a screen.
      Returns:
      the event
    • afterKeyPress

      public static Event<ScreenKeyboardEvents.AfterKeyPress> afterKeyPress(net.minecraft.client.gui.screen.Screen screen)
      An event that is called after a key press is processed for a screen.
      Returns:
      the event
    • allowKeyRelease

      public static Event<ScreenKeyboardEvents.AllowKeyRelease> allowKeyRelease(net.minecraft.client.gui.screen.Screen screen)
      An event that checks if a pressed key should be allowed to release.
      Returns:
      the event
    • beforeKeyRelease

      public static Event<ScreenKeyboardEvents.BeforeKeyRelease> beforeKeyRelease(net.minecraft.client.gui.screen.Screen screen)
      An event that is called after the release of a key is processed for a screen.
      Returns:
      the event
    • afterKeyRelease

      public static Event<ScreenKeyboardEvents.AfterKeyRelease> afterKeyRelease(net.minecraft.client.gui.screen.Screen screen)
      An event that is called after the release a key is processed for a screen.
      Returns:
      the event