Class AbstractWidget
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
- All Implemented Interfaces:
GuiEventListener, Renderable, TabOrderedElement, LayoutElement, NarratableEntry, NarrationSupplier
- Direct Known Subclasses:
AbstractScrollArea, AbstractStringWidget, AbstractWidget.WithInactiveMessage, BackgroundWithPipingWidget, EditBox, GameModeSwitcherScreen.GameModeSlot, ImageWidget, ItemDisplayWidget, LoadingDotsWidget, OverlayRecipeComponent.OverlayRecipeButton, PlayerFaceWidget, PlayerSkinWidget, RecipeButton, ResizableTextureImageWidget, SolidColorWidget
public abstract class AbstractWidget
extends Object
implements LayoutElement, Renderable, GuiEventListener, NarratableEntry
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface NarratableEntry
NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanprotected floatprivate booleanprotected intprotected booleanNeo: Stores the label text color override.protected Componentprivate intprivate final WidgetTooltipHolderbooleanprotected intprivate intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanareCoordinatesInRectangle(double x, double y) protected MutableComponentprotected voidfinal voidextractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) voidextractScrollingStringOverContents(ActiveTextCollector output, Component message, int margin) protected voidextractTooltipForNextRenderPass(GuiGraphicsExtractor graphics, int mouseX, int mouseY) protected abstract voidextractWidgetRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) floatgetAlpha()intintintNeo: Returns the widget's label text color.intgetRight()intintgetWidth()intgetX()intgetY()protected voidhandleCursor(GuiGraphicsExtractor graphics) booleanisActive()booleanbooleanbooleanbooleanisMouseOver(double mouseX, double mouseY) protected booleanisValidClickButton(MouseButtonInfo buttonInfo) booleanmouseClicked(MouseButtonEvent event, boolean doubleClick) booleanmouseDragged(MouseButtonEvent event, double dx, double dy) booleanmouseReleased(MouseButtonEvent event) nextFocusPath(FocusNavigationEvent navigationEvent) voidonClick(MouseButtonEvent event, boolean doubleClick) protected voidonDrag(MouseButtonEvent event, double dx, double dy) voidonRelease(MouseButtonEvent event) static voidplayButtonClickSound(SoundManager soundManager) voidplayDownSound(SoundManager soundManager) voidsetAlpha(float alpha) voidsetFocused(boolean focused) voidsetHeight(int height) voidsetLabelTextColor(@Nullable Integer color) Neo: Sets the label text color for this widget based on the given ARGB value, ornullto reset it to the default colors.voidsetMessage(Component message) voidsetRectangle(int width, int height, int x, int y) voidsetSize(int width, int height) voidsetTabOrderGroup(int tabOrderGroup) voidsetTooltip(@Nullable Tooltip tooltip) voidsetTooltipDelay(Duration delay) voidsetWidth(int width) voidsetX(int x) voidsetY(int y) final voidprotected abstract voidvoidvisitWidgets(Consumer<AbstractWidget> widgetVisitor) static MutableComponentwrapDefaultNarrationMessage(Component message) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface GuiEventListener
capturesInput, charTyped, getBorderForArrowNavigation, getCurrentFocusPath, keyPressed, keyReleased, mouseMoved, mouseScrolled, preeditUpdated, shouldTakeFocusAfterInteractionMethods inherited from interface LayoutElement
setPositionMethods inherited from interface NarratableEntry
getNarratables
-
Field Details
-
width
protected int width -
height
protected int height -
x
private int x -
y
private int y -
message
-
isHovered
protected boolean isHovered -
active
public boolean active -
visible
public boolean visible -
alpha
protected float alpha -
tabOrderGroup
private int tabOrderGroup -
focused
private boolean focused -
tooltip
-
labelTextColor
Neo: Stores the label text color override. SeegetLabelTextColor()andsetLabelTextColor(Integer).
-
-
Constructor Details
-
AbstractWidget
-
-
Method Details
-
getHeight
public int getHeight()- Specified by:
getHeightin interfaceLayoutElement
-
extractRenderState
public final void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) - Specified by:
extractRenderStatein interfaceRenderable
-
extractTooltipForNextRenderPass
protected void extractTooltipForNextRenderPass(GuiGraphicsExtractor graphics, int mouseX, int mouseY) -
handleCursor
-
setTooltip
-
setTooltipDelay
-
createNarrationMessage
-
wrapDefaultNarrationMessage
-
extractWidgetRenderState
protected abstract void extractWidgetRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) -
extractScrollingStringOverContents
public void extractScrollingStringOverContents(ActiveTextCollector output, Component message, int margin) -
onClick
-
onRelease
-
onDrag
-
mouseClicked
- Specified by:
mouseClickedin interfaceGuiEventListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceGuiEventListener
-
isValidClickButton
-
mouseDragged
- Specified by:
mouseDraggedin interfaceGuiEventListener
-
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) - Specified by:
isMouseOverin interfaceGuiEventListener
-
playDownSound
-
playButtonClickSound
-
getWidth
public int getWidth()- Specified by:
getWidthin interfaceLayoutElement
-
setWidth
public void setWidth(int width) -
setHeight
public void setHeight(int height) -
setAlpha
public void setAlpha(float alpha) -
getAlpha
public float getAlpha() -
setMessage
-
getMessage
-
isFocused
public boolean isFocused()- Specified by:
isFocusedin interfaceGuiEventListener
-
isHovered
public boolean isHovered() -
isHoveredOrFocused
public boolean isHoveredOrFocused() -
isActive
public boolean isActive()- Specified by:
isActivein interfaceNarratableEntry
-
setFocused
public void setFocused(boolean focused) - Specified by:
setFocusedin interfaceGuiEventListener
-
getLabelTextColor
public int getLabelTextColor()Neo: Returns the widget's label text color. If a custom text color has been set, that color will be used. If a custom text color has not been set,
CommonColors.WHITEwill be used when active, andCommonColors.LIGHT_GRAYotherwise.Subclasses may override this to provide more advanced text color handling.
- Returns:
- the widget's label text color
-
setLabelTextColor
-
narrationPriority
- Specified by:
narrationPriorityin interfaceNarratableEntry
-
updateNarration
- Specified by:
updateNarrationin interfaceNarrationSupplier
-
updateWidgetNarration
-
defaultButtonNarrationText
-
getX
public int getX()- Specified by:
getXin interfaceLayoutElement
-
setX
public void setX(int x) - Specified by:
setXin interfaceLayoutElement
-
getY
public int getY()- Specified by:
getYin interfaceLayoutElement
-
setY
public void setY(int y) - Specified by:
setYin interfaceLayoutElement
-
getRight
public int getRight() -
getBottom
public int getBottom() -
visitWidgets
- Specified by:
visitWidgetsin interfaceLayoutElement
-
setSize
public void setSize(int width, int height) -
getRectangle
- Specified by:
getRectanglein interfaceGuiEventListener- Specified by:
getRectanglein interfaceLayoutElement
-
areCoordinatesInRectangle
private boolean areCoordinatesInRectangle(double x, double y) -
setRectangle
public void setRectangle(int width, int height, int x, int y) -
getTabOrderGroup
public int getTabOrderGroup()- Specified by:
getTabOrderGroupin interfaceTabOrderedElement
-
setTabOrderGroup
public void setTabOrderGroup(int tabOrderGroup)
-