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/EditBoxWidget- intermediary - net/minecraft/class_7529- official - fpm
- 
Nested Class SummaryNested classes/interfaces inherited from interface net.minecraft.client.gui.SelectableSelectable.SelectionType
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate final EditBoxprivate static final intprivate longprivate final TextThe placeholder text that gets rendered when the edit box is empty.private final TextRendererprivate static final Stringprivate static final intFields inherited from class net.minecraft.client.gui.widget.ScrollableWidgetSCROLLBAR_WIDTHFields inherited from class net.minecraft.client.gui.widget.ClickableWidgetactive, alpha, height, hovered, visible, widthFields inherited from interface net.minecraft.client.gui.ElementMAX_DOUBLE_CLICK_INTERVAL
- 
Constructor SummaryConstructorsConstructorDescriptionEditBoxWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text placeholder, Text message) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidbooleancharTyped(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.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 delta) 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.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.ScrollableTextFieldWidgetdraw, drawBox, getContentsHeightWithPadding, getPadding, getScrollbarX, getTextMargin, getTextX, getTextY, isMouseOver, isVisible, mouseClicked, playDownSound, renderWidgetMethods inherited from class net.minecraft.client.gui.widget.ScrollableWidgetcheckScrollbarDragged, drawScrollbar, getMaxScrollY, getScrollbarThumbHeight, getScrollbarThumbY, getScrollY, mouseDragged, mouseScrolled, onRelease, overflows, refreshScroll, setScrollYMethods inherited from class net.minecraft.client.gui.widget.ClickableWidgetappendDefaultNarrations, appendNarrations, drawScrollableText, drawScrollableText, drawScrollableText, forEachChild, getBottom, getHeight, getMessage, getNarrationMessage, getNarrationMessage, getNavigationFocus, getNavigationOrder, getNavigationPath, getRight, getTooltip, 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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.ElementgetBorder, getFocusedPath, keyReleased, mouseMovedMethods inherited from interface net.minecraft.client.gui.SelectablegetNarratedPartsMethods inherited from interface net.minecraft.client.gui.widget.WidgetsetPosition
- 
Field Details- 
CURSOR_PADDINGprivate static final int CURSOR_PADDING- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - CURSOR_PADDING- Lnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_PADDING:I- intermediary - field_39502- Lnet/minecraft/class_7529;field_39502:I- official - a- Lfpm;a:I
 
- 
CURSOR_COLORprivate static final int CURSOR_COLOR- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - CURSOR_COLOR- Lnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_COLOR:I- intermediary - field_39503- Lnet/minecraft/class_7529;field_39503:I- official - c- Lfpm;c:I
 
- 
UNDERSCORE- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - UNDERSCORE- Lnet/minecraft/client/gui/widget/EditBoxWidget;UNDERSCORE:Ljava/lang/String;- intermediary - field_39504- Lnet/minecraft/class_7529;field_39504:Ljava/lang/String;- official - d- Lfpm;d:Ljava/lang/String;
 
- 
FOCUSED_BOX_TEXT_COLORprivate static final int FOCUSED_BOX_TEXT_COLOR- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - FOCUSED_BOX_TEXT_COLOR- Lnet/minecraft/client/gui/widget/EditBoxWidget;FOCUSED_BOX_TEXT_COLOR:I- intermediary - field_39505- Lnet/minecraft/class_7529;field_39505:I- official - e- Lfpm;e:I
 
- 
UNFOCUSED_BOX_TEXT_COLORprivate static final int UNFOCUSED_BOX_TEXT_COLOR- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - UNFOCUSED_BOX_TEXT_COLOR- Lnet/minecraft/client/gui/widget/EditBoxWidget;UNFOCUSED_BOX_TEXT_COLOR:I- intermediary - field_39506- Lnet/minecraft/class_7529;field_39506:I- official - f- Lfpm;f:I
 
- 
CURSOR_BLINK_INTERVALprivate static final int CURSOR_BLINK_INTERVAL- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - CURSOR_BLINK_INTERVAL- Lnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_BLINK_INTERVAL:I- intermediary - field_45363- Lnet/minecraft/class_7529;field_45363:I- official - m- Lfpm;m:I
 
- 
textRenderer- Mappings:
- Namespace - Name - Mixin selector - named - textRenderer- Lnet/minecraft/client/gui/widget/EditBoxWidget;textRenderer:Lnet/minecraft/client/font/TextRenderer;- intermediary - field_39507- Lnet/minecraft/class_7529;field_39507:Lnet/minecraft/class_327;- official - n- Lfpm;n:Lfod;
 
- 
placeholderThe 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 - placeholder- Lnet/minecraft/client/gui/widget/EditBoxWidget;placeholder:Lnet/minecraft/text/Text;- intermediary - field_39508- Lnet/minecraft/class_7529;field_39508:Lnet/minecraft/class_2561;- official - o- Lfpm;o:Lwp;
 
- 
editBox- Mappings:
- Namespace - Name - Mixin selector - named - editBox- Lnet/minecraft/client/gui/widget/EditBoxWidget;editBox:Lnet/minecraft/client/gui/EditBox;- intermediary - field_39509- Lnet/minecraft/class_7529;field_39509:Lnet/minecraft/class_7530;- official - p- Lfpm;p:Lfpp;
 
- 
lastSwitchFocusTimeprivate long lastSwitchFocusTime- Mappings:
- Namespace - Name - Mixin selector - named - lastSwitchFocusTime- Lnet/minecraft/client/gui/widget/EditBoxWidget;lastSwitchFocusTime:J- intermediary - field_45364- Lnet/minecraft/class_7529;field_45364:J- official - q- Lfpm;q:J
 
 
- 
- 
Constructor Details- 
EditBoxWidgetpublic EditBoxWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text placeholder, Text message) - 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;)V- intermediary - <init>- Lnet/minecraft/class_7529;<init>(Lnet/minecraft/class_327;IIIILnet/minecraft/class_2561;Lnet/minecraft/class_2561;)V- official - <init>- Lfpm;<init>(Lfod;IIIILwp;Lwp;)V
 
 
- 
- 
Method Details- 
setMaxLengthpublic 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- if- maxLengthis negative
- See Also:
- Mappings:
- Namespace - Name - Mixin selector - named - setMaxLength- Lnet/minecraft/client/gui/widget/EditBoxWidget;setMaxLength(I)V- intermediary - method_44402- Lnet/minecraft/class_7529;method_44402(I)V- official - a- Lfpm;a(I)V
 
- 
setChangeListenerSets 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 - setChangeListener- Lnet/minecraft/client/gui/widget/EditBoxWidget;setChangeListener(Ljava/util/function/Consumer;)V- intermediary - method_44401- Lnet/minecraft/class_7529;method_44401(Ljava/util/function/Consumer;)V- official - b- Lfpm;b(Ljava/util/function/Consumer;)V
 
- 
setTextSets the text of the edit box and moves the cursor to the end of the edit box.- Mappings:
- Namespace - Name - Mixin selector - named - setText- Lnet/minecraft/client/gui/widget/EditBoxWidget;setText(Ljava/lang/String;)V- intermediary - method_44400- Lnet/minecraft/class_7529;method_44400(Ljava/lang/String;)V- official - a- Lfpm;a(Ljava/lang/String;)V
 
- 
getTextReturns the current text of the edit box.- Returns:
- the current text of the edit box
- Mappings:
- Namespace - Name - Mixin selector - named - getText- Lnet/minecraft/client/gui/widget/EditBoxWidget;getText()Ljava/lang/String;- intermediary - method_44405- Lnet/minecraft/class_7529;method_44405()Ljava/lang/String;- official - q- Lfpm;q()Ljava/lang/String;
 
- 
appendClickableNarrations- Specified by:
- appendClickableNarrationsin class- ClickableWidget
- Mappings:
- Namespace - Name - Mixin selector - named - appendClickableNarrations- Lnet/minecraft/client/gui/widget/ClickableWidget;appendClickableNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V- intermediary - method_47399- Lnet/minecraft/class_339;method_47399(Lnet/minecraft/class_6382;)V- official - a- Lfos;a(Lfsr;)V
 
- 
onClickpublic void onClick(double mouseX, double mouseY) - Overrides:
- onClickin class- ClickableWidget
- Mappings:
- Namespace - Name - Mixin selector - named - onClick- Lnet/minecraft/client/gui/widget/ClickableWidget;onClick(DD)V- intermediary - method_25348- Lnet/minecraft/class_339;method_25348(DD)V- official - a- Lfos;a(DD)V
 
- 
onDragprotected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) - Overrides:
- onDragin class- ClickableWidget
- Mappings:
- Namespace - Name - Mixin selector - named - onDrag- Lnet/minecraft/client/gui/widget/ClickableWidget;onDrag(DDDD)V- intermediary - method_25349- Lnet/minecraft/class_339;method_25349(DDDD)V- official - b- Lfos;b(DDDD)V
 
- 
keyPressedpublic 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 interface- Element
- Overrides:
- keyPressedin class- ScrollableTextFieldWidget
- Parameters:
- keyCode- the named key code of the event as described in the- GLFWclass
- scanCode- the unique/platform-specific scan code of the keyboard input
- modifiers- 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 - keyPressed- Lnet/minecraft/client/gui/Element;keyPressed(III)Z- intermediary - method_25404- Lnet/minecraft/class_364;method_25404(III)Z- official - a- Lfqr;a(III)Z
 
- 
charTypedpublic 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 character
- modifiers- 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 - charTyped- Lnet/minecraft/client/gui/Element;charTyped(CI)Z- intermediary - method_25400- Lnet/minecraft/class_364;method_25400(CI)Z- official - a- Lfqr;a(CI)Z
 
- 
renderContents- Specified by:
- renderContentsin class- ScrollableTextFieldWidget
- Mappings:
- Namespace - Name - Mixin selector - named - renderContents- Lnet/minecraft/client/gui/widget/ScrollableTextFieldWidget;renderContents(Lnet/minecraft/client/gui/DrawContext;IIF)V- intermediary - method_44389- Lnet/minecraft/class_10415;method_44389(Lnet/minecraft/class_332;IIF)V- official - c- Lfoq;c(Lfof;IIF)V
 
- 
renderOverlay- Overrides:
- renderOverlayin class- ScrollableTextFieldWidget
- Mappings:
- Namespace - Name - Mixin selector - named - renderOverlay- Lnet/minecraft/client/gui/widget/ScrollableTextFieldWidget;renderOverlay(Lnet/minecraft/client/gui/DrawContext;)V- intermediary - method_44384- Lnet/minecraft/class_10415;method_44384(Lnet/minecraft/class_332;)V- official - b- Lfoq;b(Lfof;)V
 
- 
getContentsHeightpublic int getContentsHeight()- Specified by:
- getContentsHeightin class- ScrollableTextFieldWidget
- Mappings:
- Namespace - Name - Mixin selector - named - getContentsHeight- Lnet/minecraft/client/gui/widget/ScrollableTextFieldWidget;getContentsHeight()I- intermediary - method_44391- Lnet/minecraft/class_10415;method_44391()I- official - c- Lfoq;c()I
 
- 
getDeltaYPerScrollprotected double getDeltaYPerScroll()- Specified by:
- getDeltaYPerScrollin class- ScrollableWidget
- Mappings:
- Namespace - Name - Mixin selector - named - getDeltaYPerScroll- Lnet/minecraft/client/gui/widget/ScrollableWidget;getDeltaYPerScroll()D- intermediary - method_44393- Lnet/minecraft/class_7528;method_44393()D- official - o- Lfom;o()D
 
- 
drawSelection- Mappings:
- Namespace - Name - Mixin selector - named - drawSelection- Lnet/minecraft/client/gui/widget/EditBoxWidget;drawSelection(Lnet/minecraft/client/gui/DrawContext;IIII)V- intermediary - method_44403- Lnet/minecraft/class_7529;method_44403(Lnet/minecraft/class_332;IIII)V- official - b- Lfpm;b(Lfof;IIII)V
 
- 
onCursorChangeprivate void onCursorChange()- Mappings:
- Namespace - Name - Mixin selector - named - onCursorChange- Lnet/minecraft/client/gui/widget/EditBoxWidget;onCursorChange()V- intermediary - method_44407- Lnet/minecraft/class_7529;method_44407()V- official - r- Lfpm;r()V
 
- 
moveCursorprivate void moveCursor(double mouseX, double mouseY) - Mappings:
- Namespace - Name - Mixin selector - named - moveCursor- Lnet/minecraft/client/gui/widget/EditBoxWidget;moveCursor(DD)V- intermediary - method_44404- Lnet/minecraft/class_7529;method_44404(DD)V- official - c- Lfpm;c(DD)V
 
- 
setFocusedpublic void setFocused(boolean focused) - Specified by:
- setFocusedin interface- Element
- Overrides:
- setFocusedin class- ClickableWidget
- Mappings:
- Namespace - Name - Mixin selector - named - setFocused- Lnet/minecraft/client/gui/Element;setFocused(Z)V- intermediary - method_25365- Lnet/minecraft/class_364;method_25365(Z)V- official - a- Lfqr;a(Z)V
 
 
-