Class ScreenMouseEvents

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

@Environment(CLIENT) public final class ScreenMouseEvents extends Object
Events related to use of the mouse 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

    • allowMouseClick

      public static Event<ScreenMouseEvents.AllowMouseClick> allowMouseClick(net.minecraft.client.gui.screen.Screen screen)
      An event that checks if the mouse click should be allowed.
      Returns:
      the event
    • beforeMouseClick

      public static Event<ScreenMouseEvents.BeforeMouseClick> beforeMouseClick(net.minecraft.client.gui.screen.Screen screen)
      An event that is called before a mouse click is processed for a screen.
      Returns:
      the event
    • afterMouseClick

      public static Event<ScreenMouseEvents.AfterMouseClick> afterMouseClick(net.minecraft.client.gui.screen.Screen screen)
      An event that is called after a mouse click is processed for a screen.
      Returns:
      the event
    • allowMouseRelease

      public static Event<ScreenMouseEvents.AllowMouseRelease> allowMouseRelease(net.minecraft.client.gui.screen.Screen screen)
      An event that checks if the mouse click should be allowed to release in a screen.
      Returns:
      the event
    • beforeMouseRelease

      public static Event<ScreenMouseEvents.BeforeMouseRelease> beforeMouseRelease(net.minecraft.client.gui.screen.Screen screen)
      An event that is called before the release of a mouse click is processed for a screen.
      Returns:
      the event
    • afterMouseRelease

      public static Event<ScreenMouseEvents.AfterMouseRelease> afterMouseRelease(net.minecraft.client.gui.screen.Screen screen)
      An event that is called after the release of a mouse click is processed for a screen.
      Returns:
      the event
    • allowMouseScroll

      public static Event<ScreenMouseEvents.AllowMouseScroll> allowMouseScroll(net.minecraft.client.gui.screen.Screen screen)
      An event that is checks if the mouse should be allowed to scroll in a screen.

      This event tracks amount of vertical and horizontal scroll.

      Returns:
      the event
    • beforeMouseScroll

      public static Event<ScreenMouseEvents.BeforeMouseScroll> beforeMouseScroll(net.minecraft.client.gui.screen.Screen screen)
      An event that is called after mouse scrolling is processed for a screen.

      This event tracks amount of vertical and horizontal scroll.

      Returns:
      the event
    • afterMouseScroll

      public static Event<ScreenMouseEvents.AfterMouseScroll> afterMouseScroll(net.minecraft.client.gui.screen.Screen screen)
      An event that is called after mouse scrolling is processed for a screen.

      This event tracks amount a mouse was scrolled both vertically and horizontally.

      Returns:
      the event