public class WDynamicLabel extends WWidget
Supplier<String>.
They can be used for automatically getting data from a block entity or another data source.
Translating strings in dynamic labels should be done using
I18n.translate(String, Object...).
| Modifier and Type | Field and Description |
|---|---|
protected HorizontalAlignment |
alignment |
protected int |
color |
protected int |
darkmodeColor |
static int |
DEFAULT_DARKMODE_TEXT_COLOR |
static int |
DEFAULT_TEXT_COLOR |
protected java.util.function.Supplier<java.lang.String> |
text |
| Constructor and Description |
|---|
WDynamicLabel(java.util.function.Supplier<java.lang.String> text) |
WDynamicLabel(java.util.function.Supplier<java.lang.String> text,
int color) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canResize()
Checks whether this widget can be resized using
WWidget.setSize(int, int). |
WDynamicLabel |
disableDarkmode() |
void |
paint(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY)
Paints this widget.
|
WDynamicLabel |
setAlignment(HorizontalAlignment align) |
WDynamicLabel |
setColor(int color,
int darkmodeColor) |
WDynamicLabel |
setDarkmodeColor(int color) |
void |
setSize(int x,
int y)
Sets the size of this widget.
|
WDynamicLabel |
setText(java.util.function.Supplier<java.lang.String> text) |
addPainters, addTooltip, canFocus, createPeers, cycleFocus, getAbsoluteX, getAbsoluteY, getHeight, getHost, getParent, getWidth, getX, getY, hit, isActivationKey, isFocused, isWithinBounds, onCharTyped, onClick, onFocusGained, onFocusLost, onHidden, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseMove, onMouseScroll, onMouseUp, onShown, releaseFocus, renderTooltip, requestFocus, setHost, setLocation, setParent, tick, validateprotected java.util.function.Supplier<java.lang.String> text
protected HorizontalAlignment alignment
protected int color
protected int darkmodeColor
public static final int DEFAULT_TEXT_COLOR
public static final int DEFAULT_DARKMODE_TEXT_COLOR
public WDynamicLabel(java.util.function.Supplier<java.lang.String> text,
int color)
public WDynamicLabel(java.util.function.Supplier<java.lang.String> text)
@Environment(value=CLIENT)
public void paint(net.minecraft.client.util.math.MatrixStack matrices,
int x,
int y,
int mouseX,
int mouseY)
WWidgetpublic boolean canResize()
WWidgetWWidget.setSize(int, int).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 WDynamicLabel setDarkmodeColor(int color)
public WDynamicLabel disableDarkmode()
public WDynamicLabel setColor(int color, int darkmodeColor)
public WDynamicLabel setText(java.util.function.Supplier<java.lang.String> text)
public WDynamicLabel setAlignment(HorizontalAlignment align)