Class WDynamicLabel
java.lang.Object
io.github.cottonmc.cotton.gui.widget.WWidget
io.github.cottonmc.cotton.gui.widget.WDynamicLabel
Dynamic labels are labels that pull their text from a
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...).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HorizontalAlignmentprotected intprotected intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionWDynamicLabel(Supplier<String> text) WDynamicLabel(Supplier<String> text, int color) -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether this widget can be resized usingWWidget.setSize(int, int).voidpaint(net.minecraft.client.util.math.MatrixStack matrices, int x, int y, int mouseX, int mouseY) Paints this widget.setAlignment(HorizontalAlignment align) setColor(int color, int darkmodeColor) setDarkmodeColor(int color) voidsetSize(int x, int y) Sets the size of this widget.Methods inherited from class io.github.cottonmc.cotton.gui.widget.WWidget
addNarrations, addPainters, addTooltip, canFocus, canHover, cycleFocus, getAbsoluteX, getAbsoluteY, getHeight, getHost, getParent, getWidth, getX, getY, hit, hoveredProperty, isActivationKey, isFocused, isHovered, isNarratable, isWithinBounds, onCharTyped, onClick, onFocusGained, onFocusLost, onHidden, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseMove, onMouseScroll, onMouseUp, onShown, releaseFocus, renderTooltip, requestFocus, setHost, setHovered, setLocation, setParent, tick, validate
-
Field Details
-
text
-
alignment
-
color
protected int color -
darkmodeColor
protected int darkmodeColor -
DEFAULT_TEXT_COLOR
public static final int DEFAULT_TEXT_COLOR- See Also:
-
DEFAULT_DARKMODE_TEXT_COLOR
public static final int DEFAULT_DARKMODE_TEXT_COLOR- See Also:
-
-
Constructor Details
-
WDynamicLabel
-
WDynamicLabel
-
-
Method Details
-
paint
@Environment(CLIENT) public void paint(net.minecraft.client.util.math.MatrixStack matrices, int x, int y, int mouseX, int mouseY) Description copied from class:WWidgetPaints this widget. -
canResize
public boolean canResize()Description copied from class:WWidgetChecks whether this widget can be resized usingWWidget.setSize(int, int). -
setSize
public void setSize(int x, int y) Description copied from class:WWidgetSets the size of this widget.Overriding methods may restrict one of the dimensions to be a constant value, for example
super.setSize(x, 20). -
setDarkmodeColor
-
disableDarkmode
-
setColor
-
setText
-
setAlignment
-