public class WText extends WWidget
| Modifier and Type | Field and Description |
|---|---|
protected int |
color |
protected int |
darkmodeColor |
protected HorizontalAlignment |
horizontalAlignment |
protected net.minecraft.text.Text |
text |
protected VerticalAlignment |
verticalAlignment |
| Constructor and Description |
|---|
WText(net.minecraft.text.Text text) |
WText(net.minecraft.text.Text text,
int color) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canResize()
Checks whether this widget can be resized using
WWidget.setSize(int, int). |
WText |
disableDarkmode()
Disables separate dark mode coloring by copying the dark color to be the light color.
|
int |
getColor()
Gets the light mode color of this label.
|
int |
getDarkmodeColor()
Gets the dark mode color of this label.
|
HorizontalAlignment |
getHorizontalAlignment()
Gets the horizontal alignment of this text widget.
|
net.minecraft.text.Text |
getText()
Gets the text of this label.
|
@Nullable net.minecraft.text.Style |
getTextStyleAt(int x,
int y)
Gets the text style at the specific widget-space coordinates.
|
VerticalAlignment |
getVerticalAlignment()
Gets the vertical alignment of this text widget.
|
InputResult |
onClick(int x,
int y,
int button)
Notifies this widget that the mouse has been pressed and released, both while inside its bounds.
|
void |
paint(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY)
Paints this widget.
|
WText |
setColor(int color)
Sets the light mode color of this label.
|
WText |
setColor(int color,
int darkmodeColor)
Sets the light and dark mode colors of this label.
|
WText |
setDarkmodeColor(int darkmodeColor)
Sets the dark mode color of this label.
|
WText |
setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
Sets the horizontal alignment of this text widget.
|
void |
setSize(int x,
int y)
Sets the size of this widget.
|
WText |
setText(net.minecraft.text.Text text)
Sets the text of this label.
|
WText |
setVerticalAlignment(VerticalAlignment verticalAlignment)
Sets the vertical alignment of this text widget.
|
addPainters, addTooltip, canFocus, createPeers, cycleFocus, getAbsoluteX, getAbsoluteY, getHeight, getHost, getParent, getWidth, getX, getY, hit, isActivationKey, isFocused, isWithinBounds, onCharTyped, onFocusGained, onFocusLost, onHidden, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseMove, onMouseScroll, onMouseUp, onShown, releaseFocus, renderTooltip, requestFocus, setHost, setLocation, setParent, tick, validateprotected net.minecraft.text.Text text
protected int color
protected int darkmodeColor
protected HorizontalAlignment horizontalAlignment
protected VerticalAlignment verticalAlignment
public WText(net.minecraft.text.Text text)
public WText(net.minecraft.text.Text text,
int color)
public void setSize(int x,
int y)
WWidgetOverriding methods may restrict one of the dimensions to be
a constant value, for example super.setSize(x, 20).
public boolean canResize()
WWidgetWWidget.setSize(int, int).@Environment(value=CLIENT)
@Nullable
public @Nullable net.minecraft.text.Style getTextStyleAt(int x,
int y)
x - the X coordinate in widget spacey - the Y coordinate in widget space@Environment(value=CLIENT)
public void paint(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY)
WWidget@Environment(value=CLIENT) public InputResult onClick(int x, int y, int button)
WWidgetonClick in class WWidgetx - The X coordinate of the event, in widget-space (0 is the left edge of this widget)y - The Y coordinate of the event, in widget-space (0 is the top edge of this widget)button - The mouse button that was used. Button numbering is consistent with LWJGL Mouse (0=left, 1=right, 2=mousewheel click)InputResult.PROCESSED if the event is handled, InputResult.IGNORED otherwise.public net.minecraft.text.Text getText()
public WText setText(net.minecraft.text.Text text)
text - the new textpublic int getColor()
public WText setColor(int color)
color - the new colorpublic int getDarkmodeColor()
public WText setDarkmodeColor(int darkmodeColor)
darkmodeColor - the new colorpublic WText setColor(int color, int darkmodeColor)
color - the new light colordarkmodeColor - the new dark colorpublic WText disableDarkmode()
public HorizontalAlignment getHorizontalAlignment()
public WText setHorizontalAlignment(HorizontalAlignment horizontalAlignment)
horizontalAlignment - the new alignmentpublic VerticalAlignment getVerticalAlignment()
public WText setVerticalAlignment(VerticalAlignment verticalAlignment)
verticalAlignment - the new alignment