Class UButton

java.lang.Object
net.minecraft.client.gui.GuiComponent
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractButton
net.minecraft.client.gui.components.Button
info.u_team.u_team_core.gui.elements.UButton
All Implemented Interfaces:
BackgroundColorProvider, PerspectiveRenderable, TextProvider, TextSettingsProvider, TooltipRenderable, net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Widget, net.minecraft.client.gui.narration.NarratableEntry, net.minecraft.client.gui.narration.NarrationSupplier
Direct Known Subclasses:
AbstractSliderLogic, CheckboxButton, ImageButton, ScalableButton

public class UButton extends net.minecraft.client.gui.components.Button implements PerspectiveRenderable, BackgroundColorProvider, TextProvider
A button that fixes vanilla not drawing the continuous border if the button is smaller than 20. Also adds utility methods to add an IPressable and ITooltip
  • Nested Class Summary

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

    net.minecraft.client.gui.components.Button.OnPress, net.minecraft.client.gui.components.Button.OnTooltip

    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
    protected RGBA
     
    protected TextureProvider
     
    protected RGBA
     
    protected static final net.minecraft.client.gui.components.Button.OnTooltip
     
    protected static final net.minecraft.client.gui.components.Button.OnPress
     
    protected static final RGBA
     
    protected RGBA
     
    protected static final RGBA
     

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

    DEFAULT_HEIGHT, DEFAULT_WIDTH, NO_TOOLTIP, onPress, onTooltip, SMALL_WIDTH

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

    active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, WIDGETS_LOCATION, width, x, y

    Fields inherited from class net.minecraft.client.gui.GuiComponent

    BACKGROUND_LOCATION, GUI_ICONS_LOCATION, STATS_ICON_LOCATION

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

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Constructor
    Description
    UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text)
     
    UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text, net.minecraft.client.gui.components.Button.OnPress pessable)
     
    UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text, net.minecraft.client.gui.components.Button.OnPress pessable, net.minecraft.client.gui.components.Button.OnTooltip tooltip)
     
    UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text, net.minecraft.client.gui.components.Button.OnTooltip tooltip)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    getCurrentBackgroundColor(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
     
    net.minecraft.network.chat.Component
     
    getCurrentTextColor(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
     
     
     
    void
    renderBackground(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
     
    void
    renderButton(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
     
    void
    renderForeground(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
     
    void
    renderToolTip(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
     
    void
    setButtonColor(RGBA buttonColor)
     
    void
    setDisabledTextColor(RGBA disabledTextColor)
     
    void
     
    void
    setPressable(net.minecraft.client.gui.components.Button.OnPress pressable)
     
    void
    setTextColor(RGBA textColor)
     
    void
    setTooltip(net.minecraft.client.gui.components.Button.OnTooltip tooltip)
     

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

    onPress, renderToolTip, updateNarration

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

    keyPressed, onClick

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

    changeFocus, clearFGColor, clicked, createNarrationMessage, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getWidth, getYImage, isActive, isFocused, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, onDrag, onFocusedChanged, onRelease, playDownSound, render, renderBg, setAlpha, setFGColor, setFocused, setHeight, setMessage, setWidth, wrapDefaultNarrationMessage

    Methods inherited from class net.minecraft.client.gui.GuiComponent

    blit, blit, blit, blit, blit, blitOutlineBlack, disableScissor, drawCenteredString, drawCenteredString, drawCenteredString, drawString, drawString, drawString, enableScissor, fill, fillGradient, fillGradient, fillGradient, getBlitOffset, hLine, setBlitOffset, vLine

    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, keyReleased, mouseMoved, mouseScrolled

    Methods inherited from interface info.u_team.u_team_core.api.gui.PerspectiveRenderable

    render

    Methods inherited from interface info.u_team.u_team_core.api.gui.TextSettingsProvider

    getCurrentTextFont
  • Field Details

    • EMTPY_PRESSABLE

      protected static final net.minecraft.client.gui.components.Button.OnPress EMTPY_PRESSABLE
    • EMPTY_TOOLTIP

      protected static final net.minecraft.client.gui.components.Button.OnTooltip EMPTY_TOOLTIP
    • WHITE

      protected static final RGBA WHITE
    • LIGHT_GRAY

      protected static final RGBA LIGHT_GRAY
    • buttonTextureProvider

      protected TextureProvider buttonTextureProvider
    • buttonColor

      protected RGBA buttonColor
    • textColor

      protected RGBA textColor
    • disabledTextColor

      protected RGBA disabledTextColor
  • Constructor Details

    • UButton

      public UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text)
    • UButton

      public UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text, net.minecraft.client.gui.components.Button.OnPress pessable)
    • UButton

      public UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text, net.minecraft.client.gui.components.Button.OnTooltip tooltip)
    • UButton

      public UButton(int x, int y, int width, int height, net.minecraft.network.chat.Component text, net.minecraft.client.gui.components.Button.OnPress pessable, net.minecraft.client.gui.components.Button.OnTooltip tooltip)
  • Method Details

    • setPressable

      public void setPressable(net.minecraft.client.gui.components.Button.OnPress pressable)
    • setPressable

      public void setPressable(Runnable runnable)
    • setTooltip

      public void setTooltip(net.minecraft.client.gui.components.Button.OnTooltip tooltip)
    • getButtonColor

      public RGBA getButtonColor()
    • setButtonColor

      public void setButtonColor(RGBA buttonColor)
    • getTextColor

      public RGBA getTextColor()
    • setTextColor

      public void setTextColor(RGBA textColor)
    • getDisabledTextColor

      public RGBA getDisabledTextColor()
    • setDisabledTextColor

      public void setDisabledTextColor(RGBA disabledTextColor)
    • renderButton

      public void renderButton(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
      Overrides:
      renderButton in class net.minecraft.client.gui.components.Button
    • renderBackground

      public void renderBackground(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
      Specified by:
      renderBackground in interface PerspectiveRenderable
    • renderForeground

      public void renderForeground(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
      Specified by:
      renderForeground in interface PerspectiveRenderable
    • renderToolTip

      public void renderToolTip(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
      Specified by:
      renderToolTip in interface TooltipRenderable
    • getCurrentBackgroundColor

      public RGBA getCurrentBackgroundColor(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
      Specified by:
      getCurrentBackgroundColor in interface BackgroundColorProvider
    • getCurrentText

      public net.minecraft.network.chat.Component getCurrentText()
      Specified by:
      getCurrentText in interface TextProvider
    • getCurrentTextColor

      public RGBA getCurrentTextColor(com.mojang.blaze3d.vertex.PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
      Specified by:
      getCurrentTextColor in interface TextSettingsProvider