Package net.minecraft.client.gui.widget
Class EditBoxWidget
java.lang.Object
net.minecraft.client.gui.widget.ClickableWidget
net.minecraft.client.gui.widget.ScrollableWidget
net.minecraft.client.gui.widget.ScrollableTextFieldWidget
net.minecraft.client.gui.widget.EditBoxWidget
- All Implemented Interfaces:
Drawable,Element,Narratable,Navigable,Selectable,Widget
A widget of
EditBox, a multiline edit box with support for
basic keyboard shortcuts. This class implements the rendering and scrolling
for the edit box.- Mappings:
Namespace Name named net/minecraft/client/gui/widget/EditBoxWidgetintermediary net/minecraft/class_7529official fyg
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface net.minecraft.client.gui.Selectable
Selectable.SelectionType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate final intprivate final EditBoxprivate static final intprivate longprivate final TextThe placeholder text that gets rendered when the edit box is empty.private final intprivate final TextRendererprivate final booleanprivate static final Stringprivate static final intFields inherited from class net.minecraft.client.gui.widget.ScrollableTextFieldWidget
field_60867Fields inherited from class net.minecraft.client.gui.widget.ScrollableWidget
SCROLLBAR_WIDTHFields inherited from class net.minecraft.client.gui.widget.ClickableWidget
active, alpha, height, hovered, visible, widthFields inherited from interface net.minecraft.client.gui.Element
MAX_DOUBLE_CLICK_INTERVAL -
Constructor Summary
ConstructorsConstructorDescriptionEditBoxWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text placeholder, Text message, int textColor, boolean textShadow, int cursorColor, boolean hasBackground, boolean hasOverlay) -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic EditBoxWidget.Builderbuilder()booleancharTyped(char chr, int modifiers) Callback for when a character input has been captured.private voiddrawSelection(DrawContext context, int left, int top, int right, int bottom) intprotected doublegetText()Returns the current text of the edit box.booleankeyPressed(int keyCode, int scanCode, int modifiers) Callback for when a key down event has been captured.voidmethod_72234(String string, boolean bool) private voidmoveCursor(double mouseX, double mouseY) voidonClick(double mouseX, double mouseY) private voidprotected voidonDrag(double mouseX, double mouseY, double deltaX, double deltaY) protected voidrenderContents(DrawContext context, int mouseX, int mouseY, float deltaTicks) protected voidrenderOverlay(DrawContext context) voidsetChangeListener(Consumer<String> changeListener) Sets the change listener that is called every time the text changes.voidsetFocused(boolean focused) voidsetMaxLength(int maxLength) Sets the maximum length of the edit box text in characters.voidsetMaxLines(int maxLines) voidSets the text of the edit box and moves the cursor to the end of the edit box.Methods inherited from class net.minecraft.client.gui.widget.ScrollableTextFieldWidget
draw, drawBox, getContentsHeightWithPadding, getPadding, getScrollbarX, getTextMargin, getTextX, getTextY, isMouseOver, isVisible, mouseClicked, playDownSound, renderWidgetMethods inherited from class net.minecraft.client.gui.widget.ScrollableWidget
checkScrollbarDragged, drawScrollbar, getMaxScrollY, getScrollbarThumbHeight, getScrollbarThumbY, getScrollY, mouseDragged, mouseScrolled, onRelease, overflows, refreshScroll, setScrollYMethods inherited from class net.minecraft.client.gui.widget.ClickableWidget
appendDefaultNarrations, appendNarrations, drawScrollableText, drawScrollableText, drawScrollableText, forEachChild, getBottom, getHeight, getMessage, getNarrationMessage, getNarrationMessage, getNavigationFocus, getNavigationOrder, getNavigationPath, getRight, getType, getWidth, getX, getY, isFocused, isHovered, isNarratable, isSelected, isValidClickButton, mouseReleased, playClickSound, render, setAlpha, setDimensions, setDimensionsAndPosition, setHeight, setMessage, setNavigationOrder, setTooltip, setTooltipDelay, setWidth, setX, setYMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
getBorder, getFocusedPath, keyReleased, mouseMovedMethods inherited from interface net.minecraft.client.gui.Selectable
getNarratedPartsMethods inherited from interface net.minecraft.client.gui.widget.Widget
setPosition
-
Field Details
-
CURSOR_PADDING
private static final int CURSOR_PADDING- See Also:
- Mappings:
Namespace Name Mixin selector named CURSOR_PADDINGLnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_PADDING:Iintermediary field_39502Lnet/minecraft/class_7529;field_39502:Iofficial cLfyg;c:I
-
CURSOR_COLOR
private static final int CURSOR_COLOR- See Also:
- Mappings:
Namespace Name Mixin selector named CURSOR_COLORLnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_COLOR:Iintermediary field_39503Lnet/minecraft/class_7529;field_39503:Iofficial dLfyg;d:I
-
UNDERSCORE
- See Also:
- Mappings:
Namespace Name Mixin selector named UNDERSCORELnet/minecraft/client/gui/widget/EditBoxWidget;UNDERSCORE:Ljava/lang/String;intermediary field_39504Lnet/minecraft/class_7529;field_39504:Ljava/lang/String;official eLfyg;e:Ljava/lang/String;
-
FOCUSED_BOX_TEXT_COLOR
private static final int FOCUSED_BOX_TEXT_COLOR- See Also:
- Mappings:
Namespace Name Mixin selector named FOCUSED_BOX_TEXT_COLORLnet/minecraft/client/gui/widget/EditBoxWidget;FOCUSED_BOX_TEXT_COLOR:Iintermediary field_39505Lnet/minecraft/class_7529;field_39505:Iofficial fLfyg;f:I
-
UNFOCUSED_BOX_TEXT_COLOR
private static final int UNFOCUSED_BOX_TEXT_COLOR- See Also:
- Mappings:
Namespace Name Mixin selector named UNFOCUSED_BOX_TEXT_COLORLnet/minecraft/client/gui/widget/EditBoxWidget;UNFOCUSED_BOX_TEXT_COLOR:Iintermediary field_39506Lnet/minecraft/class_7529;field_39506:Iofficial mLfyg;m:I
-
CURSOR_BLINK_INTERVAL
private static final int CURSOR_BLINK_INTERVAL- See Also:
- Mappings:
Namespace Name Mixin selector named CURSOR_BLINK_INTERVALLnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_BLINK_INTERVAL:Iintermediary field_45363Lnet/minecraft/class_7529;field_45363:Iofficial nLfyg;n:I
-
textRenderer
- Mappings:
Namespace Name Mixin selector named textRendererLnet/minecraft/client/gui/widget/EditBoxWidget;textRenderer:Lnet/minecraft/client/font/TextRenderer;intermediary field_39507Lnet/minecraft/class_7529;field_39507:Lnet/minecraft/class_327;official oLfyg;o:Lfwy;
-
placeholder
The placeholder text that gets rendered when the edit box is empty. This does not get returned fromgetText(); an empty string will be returned in such cases.- Mappings:
Namespace Name Mixin selector named placeholderLnet/minecraft/client/gui/widget/EditBoxWidget;placeholder:Lnet/minecraft/text/Text;intermediary field_39508Lnet/minecraft/class_7529;field_39508:Lnet/minecraft/class_2561;official pLfyg;p:Lxo;
-
editBox
- Mappings:
Namespace Name Mixin selector named editBoxLnet/minecraft/client/gui/widget/EditBoxWidget;editBox:Lnet/minecraft/client/gui/EditBox;intermediary field_39509Lnet/minecraft/class_7529;field_39509:Lnet/minecraft/class_7530;official qLfyg;q:Lfyj;
-
textColor
private final int textColor- Mappings:
Namespace Name Mixin selector named textColorLnet/minecraft/client/gui/widget/EditBoxWidget;textColor:Iintermediary field_60439Lnet/minecraft/class_7529;field_60439:Iofficial rLfyg;r:I
-
textShadow
private final boolean textShadow- Mappings:
Namespace Name Mixin selector named textShadowLnet/minecraft/client/gui/widget/EditBoxWidget;textShadow:Zintermediary field_60440Lnet/minecraft/class_7529;field_60440:Zofficial sLfyg;s:Z
-
cursorColor
private final int cursorColor- Mappings:
Namespace Name Mixin selector named cursorColorLnet/minecraft/client/gui/widget/EditBoxWidget;cursorColor:Iintermediary field_60441Lnet/minecraft/class_7529;field_60441:Iofficial uLfyg;u:I
-
lastSwitchFocusTime
private long lastSwitchFocusTime- Mappings:
Namespace Name Mixin selector named lastSwitchFocusTimeLnet/minecraft/client/gui/widget/EditBoxWidget;lastSwitchFocusTime:Jintermediary field_45364Lnet/minecraft/class_7529;field_45364:Jofficial vLfyg;v:J
-
-
Constructor Details
-
EditBoxWidget
EditBoxWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text placeholder, Text message, int textColor, boolean textShadow, int cursorColor, boolean hasBackground, boolean hasOverlay) - Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/client/gui/widget/EditBoxWidget;<init>(Lnet/minecraft/client/font/TextRenderer;IIIILnet/minecraft/text/Text;Lnet/minecraft/text/Text;IZIZZ)Vintermediary <init>Lnet/minecraft/class_7529;<init>(Lnet/minecraft/class_327;IIIILnet/minecraft/class_2561;Lnet/minecraft/class_2561;IZIZZ)Vofficial <init>Lfyg;<init>(Lfwy;IIIILxo;Lxo;IZIZZ)V
-
-
Method Details
-
setMaxLength
public void setMaxLength(int maxLength) Sets the maximum length of the edit box text in characters.If
maxLengthequalsEditBox.UNLIMITED_LENGTH, the edit box does not have a length limit, and the widget does not show the current text length indicator.- Throws:
IllegalArgumentException- ifmaxLengthis negative- See Also:
- Mappings:
Namespace Name Mixin selector named setMaxLengthLnet/minecraft/client/gui/widget/EditBoxWidget;setMaxLength(I)Vintermediary method_44402Lnet/minecraft/class_7529;method_44402(I)Vofficial aLfyg;a(I)V
-
setMaxLines
public void setMaxLines(int maxLines) - Mappings:
Namespace Name Mixin selector named setMaxLinesLnet/minecraft/client/gui/widget/EditBoxWidget;setMaxLines(I)Vintermediary method_71506Lnet/minecraft/class_7529;method_71506(I)Vofficial bLfyg;b(I)V
-
setChangeListener
Sets the change listener that is called every time the text changes.- Parameters:
changeListener- the listener that takes the new text of the edit box- Mappings:
Namespace Name Mixin selector named setChangeListenerLnet/minecraft/client/gui/widget/EditBoxWidget;setChangeListener(Ljava/util/function/Consumer;)Vintermediary method_44401Lnet/minecraft/class_7529;method_44401(Ljava/util/function/Consumer;)Vofficial bLfyg;b(Ljava/util/function/Consumer;)V
-
setText
Sets the text of the edit box and moves the cursor to the end of the edit box.- Mappings:
Namespace Name Mixin selector named setTextLnet/minecraft/client/gui/widget/EditBoxWidget;setText(Ljava/lang/String;)Vintermediary method_44400Lnet/minecraft/class_7529;method_44400(Ljava/lang/String;)Vofficial aLfyg;a(Ljava/lang/String;)V
-
method_72234
- Mappings:
Namespace Name Mixin selector named method_72234Lnet/minecraft/client/gui/widget/EditBoxWidget;method_72234(Ljava/lang/String;Z)Vintermediary method_72234Lnet/minecraft/class_7529;method_72234(Ljava/lang/String;Z)Vofficial aLfyg;a(Ljava/lang/String;Z)V
-
getText
Returns the current text of the edit box.- Returns:
- the current text of the edit box
- Mappings:
Namespace Name Mixin selector named getTextLnet/minecraft/client/gui/widget/EditBoxWidget;getText()Ljava/lang/String;intermediary method_44405Lnet/minecraft/class_7529;method_44405()Ljava/lang/String;official qLfyg;q()Ljava/lang/String;
-
appendClickableNarrations
- Specified by:
appendClickableNarrationsin classClickableWidget- Mappings:
Namespace Name Mixin selector named appendClickableNarrationsLnet/minecraft/client/gui/widget/ClickableWidget;appendClickableNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)Vintermediary method_47399Lnet/minecraft/class_339;method_47399(Lnet/minecraft/class_6382;)Vofficial aLfxl;a(Lgbs;)V
-
onClick
public void onClick(double mouseX, double mouseY) - Overrides:
onClickin classClickableWidget- Mappings:
Namespace Name Mixin selector named onClickLnet/minecraft/client/gui/widget/ClickableWidget;onClick(DD)Vintermediary method_25348Lnet/minecraft/class_339;method_25348(DD)Vofficial aLfxl;a(DD)V
-
onDrag
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) - Overrides:
onDragin classClickableWidget- Mappings:
Namespace Name Mixin selector named onDragLnet/minecraft/client/gui/widget/ClickableWidget;onDrag(DDDD)Vintermediary method_25349Lnet/minecraft/class_339;method_25349(DDDD)Vofficial bLfxl;b(DDDD)V
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Callback for when a key down event has been captured. The key code is identified by the constants inGLFWclass.- Specified by:
keyPressedin interfaceElement- Overrides:
keyPressedin classScrollableTextFieldWidget- Parameters:
keyCode- the named key code of the event as described in theGLFWclassscanCode- the unique/platform-specific scan code of the keyboard inputmodifiers- a GLFW bitfield describing the modifier keys that are held down (see GLFW Modifier key flags)- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named keyPressedLnet/minecraft/client/gui/Element;keyPressed(III)Zintermediary method_25404Lnet/minecraft/class_364;method_25404(III)Zofficial aLfzm;a(III)Z
-
charTyped
public boolean charTyped(char chr, int modifiers) Callback for when a character input has been captured. The key code is identified by the constants inGLFWclass.- Parameters:
chr- the captured charactermodifiers- a GLFW bitfield describing the modifier keys that are held down (see GLFW Modifier key flags)- Returns:
trueto indicate that the event handling is successful/valid- See Also:
- Mappings:
Namespace Name Mixin selector named charTypedLnet/minecraft/client/gui/Element;charTyped(CI)Zintermediary method_25400Lnet/minecraft/class_364;method_25400(CI)Zofficial aLfzm;a(CI)Z
-
renderContents
- Specified by:
renderContentsin classScrollableTextFieldWidget- Mappings:
Namespace Name Mixin selector named renderContentsLnet/minecraft/client/gui/widget/ScrollableTextFieldWidget;renderContents(Lnet/minecraft/client/gui/DrawContext;IIF)Vintermediary method_44389Lnet/minecraft/class_10415;method_44389(Lnet/minecraft/class_332;IIF)Vofficial cLfxk;c(Lfxa;IIF)V
-
renderOverlay
- Overrides:
renderOverlayin classScrollableTextFieldWidget- Mappings:
Namespace Name Mixin selector named renderOverlayLnet/minecraft/client/gui/widget/ScrollableTextFieldWidget;renderOverlay(Lnet/minecraft/client/gui/DrawContext;)Vintermediary method_44384Lnet/minecraft/class_10415;method_44384(Lnet/minecraft/class_332;)Vofficial aLfxk;a(Lfxa;)V
-
getContentsHeight
public int getContentsHeight()- Specified by:
getContentsHeightin classScrollableTextFieldWidget- Mappings:
Namespace Name Mixin selector named getContentsHeightLnet/minecraft/client/gui/widget/ScrollableTextFieldWidget;getContentsHeight()Iintermediary method_44391Lnet/minecraft/class_10415;method_44391()Iofficial cLfxk;c()I
-
getDeltaYPerScroll
protected double getDeltaYPerScroll()- Specified by:
getDeltaYPerScrollin classScrollableWidget- Mappings:
Namespace Name Mixin selector named getDeltaYPerScrollLnet/minecraft/client/gui/widget/ScrollableWidget;getDeltaYPerScroll()Dintermediary method_44393Lnet/minecraft/class_7528;method_44393()Dofficial oLfxg;o()D
-
drawSelection
- Mappings:
Namespace Name Mixin selector named drawSelectionLnet/minecraft/client/gui/widget/EditBoxWidget;drawSelection(Lnet/minecraft/client/gui/DrawContext;IIII)Vintermediary method_44403Lnet/minecraft/class_7529;method_44403(Lnet/minecraft/class_332;IIII)Vofficial bLfyg;b(Lfxa;IIII)V
-
onCursorChange
private void onCursorChange()- Mappings:
Namespace Name Mixin selector named onCursorChangeLnet/minecraft/client/gui/widget/EditBoxWidget;onCursorChange()Vintermediary method_44407Lnet/minecraft/class_7529;method_44407()Vofficial sLfyg;s()V
-
moveCursor
private void moveCursor(double mouseX, double mouseY) - Mappings:
Namespace Name Mixin selector named moveCursorLnet/minecraft/client/gui/widget/EditBoxWidget;moveCursor(DD)Vintermediary method_44404Lnet/minecraft/class_7529;method_44404(DD)Vofficial cLfyg;c(DD)V
-
setFocused
public void setFocused(boolean focused) - Specified by:
setFocusedin interfaceElement- Overrides:
setFocusedin classClickableWidget- Mappings:
Namespace Name Mixin selector named setFocusedLnet/minecraft/client/gui/Element;setFocused(Z)Vintermediary method_25365Lnet/minecraft/class_364;method_25365(Z)Vofficial aLfzm;a(Z)V
-
builder
- Mappings:
Namespace Name Mixin selector named builderLnet/minecraft/client/gui/widget/EditBoxWidget;builder()Lnet/minecraft/client/gui/widget/EditBoxWidget$Builder;intermediary method_71507Lnet/minecraft/class_7529;method_71507()Lnet/minecraft/class_7529$class_11383;official rLfyg;r()Lfyg$a;
-