Interface IOverlayListener


public interface IOverlayListener
Interface for receiving user events related to an Overlay.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onActivate(UIState mapState)
    Called when the Overlay is actively displayed.
    default void
    Called when Overlay is no longer displayed.
    default boolean
    onMouseClick(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition, int button, boolean doubleClick)
    Called when the mouse is clicked within the bounds of the overlay.
    default void
    onMouseMove(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition)
    Called when the mouse moves within the bounds of the overlay.
    default void
    onMouseOut(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition)
    Called when the mouse first leaves the bounds of the overlay.
    default void
    onOverlayMenuPopup(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition, ModPopupMenu modPopupMenu)
    Called when the popup menu is displayed on an overlay.
  • Method Details

    • onActivate

      default void onActivate(UIState mapState)
      Called when the Overlay is actively displayed.
      Parameters:
      mapState - current UIState of the UI where the overlay is active.
    • onDeactivate

      default void onDeactivate(UIState mapState)
      Called when Overlay is no longer displayed.
      Parameters:
      mapState - current UIState of the UI where the overlay is inactive.
    • onMouseMove

      default void onMouseMove(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition)
      Called when the mouse moves within the bounds of the overlay.
      Parameters:
      mapState - current UIState of the UI where the overlay is active.
      mousePosition - screen coordinates of the mouse
      blockPosition - the block position under the mouse
    • onMouseOut

      default void onMouseOut(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition)
      Called when the mouse first leaves the bounds of the overlay.
      Parameters:
      mapState - current UIState of the UI where the overlay is active.
      mousePosition - screen coordinates of the mouse
      blockPosition - the block position under the mouse
    • onMouseClick

      default boolean onMouseClick(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition, int button, boolean doubleClick)
      Called when the mouse is clicked within the bounds of the overlay.
      Parameters:
      mapState - current UIState of the UI where the overlay is active.
      mousePosition - screen coordinates of the mouse
      blockPosition - the block position under the mouse
      button - the mouse button clicked
      doubleClick - true if the mouse button was double-clicked
      Returns:
      true if click event can bubble up to other overlays which occupy the same area.
    • onOverlayMenuPopup

      default void onOverlayMenuPopup(UIState mapState, Point2D.Double mousePosition, net.minecraft.core.BlockPos blockPosition, ModPopupMenu modPopupMenu)
      Called when the popup menu is displayed on an overlay.
      Parameters:
      mapState - current UIState of the UI where the overlay is active.
      mousePosition - screen coordinates of the mouse
      blockPosition - the block position under the mouse
      modPopupMenu - the modMenuPopup