Class ScreenMouseEvents

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

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(Screen screen)
      An event that checks if the mouse click should be allowed.
      Returns:
      the event
    • beforeMouseClick

      public static Event<ScreenMouseEvents.BeforeMouseClick> beforeMouseClick(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(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(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(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(Screen screen)
      An event that is called after the release of a mouse click is processed for a screen.
      Returns:
      the event
    • allowMouseDrag

      public static Event<ScreenMouseEvents.AllowMouseDrag> allowMouseDrag(Screen screen)
      An event that checks if the mouse should be allowed to drag in a screen.

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

      Returns:
      the event
    • beforeMouseDrag

      public static Event<ScreenMouseEvents.BeforeMouseDrag> beforeMouseDrag(Screen screen)
      An event called after mouse dragging is processed for a screen.

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

      Returns:
      the event
    • afterMouseDrag

      public static Event<ScreenMouseEvents.AfterMouseDrag> afterMouseDrag(Screen screen)
      An event called after mouse dragging is processed for a screen.

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

      Returns:
      the event
    • allowMouseScroll

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

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

      Returns:
      the event
    • beforeMouseScroll

      public static Event<ScreenMouseEvents.BeforeMouseScroll> beforeMouseScroll(Screen screen)
      An event called before mouse scrolling is processed for a screen.

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

      Returns:
      the event
    • afterMouseScroll

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

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

      Returns:
      the event