Class AuthButtonWidget

java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractButton
net.minecraft.client.gui.components.Button
net.minecraft.client.gui.components.ImageButton
me.axieum.mcmod.authme.api.gui.widget.AuthButtonWidget
All Implemented Interfaces:
net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.layouts.LayoutElement, net.minecraft.client.gui.narration.NarratableEntry, net.minecraft.client.gui.narration.NarrationSupplier

public class AuthButtonWidget extends net.minecraft.client.gui.components.ImageButton
The textured button widget for opening the authentication screens.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    A functional interface for widget relocation callback.

    Nested classes/interfaces inherited from class net.minecraft.client.gui.components.Button

    net.minecraft.client.gui.components.Button.Builder, net.minecraft.client.gui.components.Button.CreateNarration, net.minecraft.client.gui.components.Button.OnPress

    Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry

    net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.client.gui.components.WidgetSprites
    The authentication button textures.
    static final net.minecraft.resources.ResourceLocation
    The session status icon texture.

    Fields inherited from class net.minecraft.client.gui.components.ImageButton

    sprites

    Fields inherited from class net.minecraft.client.gui.components.Button

    BIG_WIDTH, createNarration, DEFAULT_HEIGHT, DEFAULT_NARRATION, DEFAULT_SPACING, DEFAULT_WIDTH, onPress, SMALL_WIDTH

    Fields inherited from class net.minecraft.client.gui.components.AbstractButton

    TEXT_MARGIN

    Fields inherited from class net.minecraft.client.gui.components.AbstractWidget

    active, alpha, height, isHovered, visible, width
  • Constructor Summary

    Constructors
    Constructor
    Description
    AuthButtonWidget(int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction)
    Constructs a fixed (no drag) authentication button.
    AuthButtonWidget(int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable net.minecraft.client.gui.components.Tooltip tooltip, @Nullable net.minecraft.network.chat.Component message)
    Constructs a fixed (no drag) authentication button with non-visible text and a tooltip.
    AuthButtonWidget(int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable net.minecraft.network.chat.Component message)
    Constructs a fixed (no drag) authentication button with non-visible text.
    AuthButtonWidget(@Nullable net.minecraft.client.gui.screens.Screen screen, int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable AuthButtonWidget.MoveAction moveAction)
    Constructs a movable (with drag) authentication button.
    AuthButtonWidget(@Nullable net.minecraft.client.gui.screens.Screen screen, int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable AuthButtonWidget.MoveAction moveAction, @Nullable net.minecraft.client.gui.components.Tooltip tooltip, net.minecraft.network.chat.Component message)
    Constructs a movable (with drag) authentication button with non-visible text and a tooltip.
    AuthButtonWidget(@Nullable net.minecraft.client.gui.screens.Screen screen, int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable AuthButtonWidget.MoveAction moveAction, @Nullable net.minecraft.network.chat.Component message)
    Constructs a movable (with drag) authentication button with non-visible text.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the last known Minecraft session status.
    boolean
    mouseClicked(net.minecraft.client.input.MouseButtonEvent mouseButtonEvent, boolean doubleClick)
    Adjusts the default mouse down behaviour to not trigger a click - rather handle clicks on mouse up/release.
    boolean
    mouseReleased(net.minecraft.client.input.MouseButtonEvent mouseButtonEvent)
    Adjusts the default mouse up behaviour to trigger a click.
    protected void
    onDrag(net.minecraft.client.input.MouseButtonEvent event, double deltaX, double deltaY)
    Allows the button to be moved while dragging.
    void
    Refreshes the Minecraft session status.
    void
    renderWidget(net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float delta)
     
    void
    Sets the Minecraft session status.

    Methods inherited from class net.minecraft.client.gui.components.Button

    builder, createNarrationMessage, onPress, updateWidgetNarration

    Methods inherited from class net.minecraft.client.gui.components.AbstractButton

    keyPressed, onClick, renderString

    Methods inherited from class net.minecraft.client.gui.components.AbstractWidget

    defaultButtonNarrationText, getBottom, getHeight, getMessage, getRectangle, getRight, getTabOrderGroup, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseDragged, narrationPriority, nextFocusPath, onRelease, playButtonClickSound, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFocused, setHeight, setMessage, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessage

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    charTyped, getBorderForArrowNavigation, getCurrentFocusPath, keyReleased, mouseMoved, mouseScrolled, shouldTakeFocusAfterInteraction

    Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement

    setPosition

    Methods inherited from interface net.minecraft.client.gui.narration.NarratableEntry

    getNarratables
  • Field Details

    • BUTTON_TEXTURES

      public static final net.minecraft.client.gui.components.WidgetSprites BUTTON_TEXTURES
      The authentication button textures.
    • SESSION_STATUS_TEXTURE

      public static final net.minecraft.resources.ResourceLocation SESSION_STATUS_TEXTURE
      The session status icon texture.
  • Constructor Details

    • AuthButtonWidget

      public AuthButtonWidget(int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction)
      Constructs a fixed (no drag) authentication button.
      Parameters:
      x - x coordinate
      y - y coordinate
      pressAction - on click action
      See Also:
    • AuthButtonWidget

      public AuthButtonWidget(int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable @Nullable net.minecraft.network.chat.Component message)
      Constructs a fixed (no drag) authentication button with non-visible text.
      Parameters:
      x - x coordinate
      y - y coordinate
      pressAction - on click action
      message - non-visible button text
      See Also:
    • AuthButtonWidget

      public AuthButtonWidget(int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable @Nullable net.minecraft.client.gui.components.Tooltip tooltip, @Nullable @Nullable net.minecraft.network.chat.Component message)
      Constructs a fixed (no drag) authentication button with non-visible text and a tooltip.
      Parameters:
      x - x coordinate
      y - y coordinate
      pressAction - on click action
      tooltip - tooltip
      message - non-visible button text
      See Also:
    • AuthButtonWidget

      public AuthButtonWidget(@Nullable @Nullable net.minecraft.client.gui.screens.Screen screen, int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable @Nullable AuthButtonWidget.MoveAction moveAction)
      Constructs a movable (with drag) authentication button.
      Parameters:
      screen - screen to constrain movement to
      x - initial x coordinate
      y - initial y coordinate
      pressAction - on click action
      moveAction - on move action
      See Also:
    • AuthButtonWidget

      public AuthButtonWidget(@Nullable @Nullable net.minecraft.client.gui.screens.Screen screen, int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable @Nullable AuthButtonWidget.MoveAction moveAction, @Nullable @Nullable net.minecraft.network.chat.Component message)
      Constructs a movable (with drag) authentication button with non-visible text.
      Parameters:
      screen - screen to constrain movement to
      x - initial x coordinate
      y - initial y coordinate
      pressAction - on click action
      moveAction - on move action
      message - non-visible button text
      See Also:
    • AuthButtonWidget

      public AuthButtonWidget(@Nullable @Nullable net.minecraft.client.gui.screens.Screen screen, int x, int y, net.minecraft.client.gui.components.Button.OnPress pressAction, @Nullable @Nullable AuthButtonWidget.MoveAction moveAction, @Nullable @Nullable net.minecraft.client.gui.components.Tooltip tooltip, net.minecraft.network.chat.Component message)
      Constructs a movable (with drag) authentication button with non-visible text and a tooltip.
      Parameters:
      screen - screen to constrain movement to
      x - initial x coordinate
      y - initial y coordinate
      pressAction - on click action
      moveAction - on move action
      tooltip - tooltip
      message - non-visible button text
  • Method Details

    • getSessionStatus

      public SessionUtils.SessionStatus getSessionStatus()
      Returns the last known Minecraft session status.
      Returns:
      cached Minecraft session status
    • refreshSessionStatus

      public void refreshSessionStatus()
      Refreshes the Minecraft session status.
    • setSessionStatus

      public void setSessionStatus(SessionUtils.SessionStatus sessionStatus)
      Sets the Minecraft session status.
      Parameters:
      sessionStatus - Minecraft session status
    • mouseClicked

      public boolean mouseClicked(net.minecraft.client.input.MouseButtonEvent mouseButtonEvent, boolean doubleClick)
      Adjusts the default mouse down behaviour to not trigger a click - rather handle clicks on mouse up/release. This allows the user to initially click to begin dragging the button to a new position.
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      mouseClicked in class net.minecraft.client.gui.components.AbstractWidget
      See Also:
    • mouseReleased

      public boolean mouseReleased(net.minecraft.client.input.MouseButtonEvent mouseButtonEvent)
      Adjusts the default mouse up behaviour to trigger a click.
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      mouseReleased in class net.minecraft.client.gui.components.AbstractWidget
      See Also:
      • AbstractWidget.mouseClicked(MouseButtonEvent mouseButtonEvent, boolean bl)
    • onDrag

      protected void onDrag(net.minecraft.client.input.MouseButtonEvent event, double deltaX, double deltaY)
      Allows the button to be moved while dragging.
      Overrides:
      onDrag in class net.minecraft.client.gui.components.AbstractWidget
      See Also:
    • renderWidget

      public void renderWidget(net.minecraft.client.gui.GuiGraphics context, int mouseX, int mouseY, float delta)
      Overrides:
      renderWidget in class net.minecraft.client.gui.components.ImageButton