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.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 - official - epy- intermediary - net/minecraft/class_7529- named - net/minecraft/client/gui/widget/EditBoxWidget
- 
Nested Class SummaryNested classes/interfaces inherited from interface net.minecraft.client.gui.SelectableSelectable.SelectionType
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate final EditBoxprivate static final intprivate final TextThe placeholder text that gets rendered when the edit box is empty.private final TextRendererprivate intprivate static final Stringprivate static final intFields inherited from class net.minecraft.client.gui.widget.ClickableWidgetACCESSIBILITY_TEXTURE, active, alpha, height, hovered, visible, WIDGETS_TEXTURE, 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) intReturns the total height of the contents.protected doubleprivate doubleReturns the maximum amount of lines the widget can hold without overflowing.getText()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.booleanmouseClicked(double mouseX, double mouseY, int button) Callback for when a mouse button down event has been captured.booleanmouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) Callback for when a mouse button drag event has been captured.private voidmoveCursor(double mouseX, double mouseY) private voidprotected booleanReturns whether the contents overflow and needs a scrollbar.protected voidrenderContents(DrawContext context, int mouseX, int mouseY, float delta) Renders the scrolled contents.protected voidrenderOverlay(DrawContext context) Renders overlays that are not scrolled but part of the widget.voidsetChangeListener(Consumer<String> changeListener) Sets the change listener that is called every time the text changes.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.voidtick()Methods inherited from class net.minecraft.client.gui.widget.ScrollableWidgetdrawBox, drawBox, getMaxScrollY, getPadding, getPaddingDoubled, getScrollY, isVisible, isWithinBounds, mouseReleased, mouseScrolled, renderButton, setScrollYMethods inherited from class net.minecraft.client.gui.widget.ClickableWidgetappendDefaultNarrations, appendNarrations, clicked, drawScrollableText, drawScrollableText, drawTexture, forEachChild, getHeight, getMessage, getNarrationMessage, getNarrationMessage, getNavigationFocus, getNavigationOrder, getNavigationPath, getTooltip, getTooltipPositioner, getType, getWidth, getX, getY, isFocused, isHovered, isMouseOver, isNarratable, isSelected, isValidClickButton, onClick, onDrag, onRelease, playDownSound, render, setAlpha, setFocused, 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.ElementgetFocusedPath, getNavigationFocus, getNavigationPath, isFocused, isMouseOver, keyReleased, mouseMoved, setFocusedMethods inherited from interface net.minecraft.client.gui.navigation.NavigablegetNavigationOrderMethods 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 - official - a- Lepy;a:I- intermediary - field_39502- Lnet/minecraft/class_7529;field_39502:I- named - CURSOR_PADDING- Lnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_PADDING:I
 
- 
CURSOR_COLORprivate static final int CURSOR_COLOR- See Also:
- Mappings:
- Namespace - Name - Mixin selector - official - b- Lepy;b:I- intermediary - field_39503- Lnet/minecraft/class_7529;field_39503:I- named - CURSOR_COLOR- Lnet/minecraft/client/gui/widget/EditBoxWidget;CURSOR_COLOR:I
 
- 
UNDERSCORE- See Also:
- Mappings:
- Namespace - Name - Mixin selector - official - c- Lepy;c:Ljava/lang/String;- intermediary - field_39504- Lnet/minecraft/class_7529;field_39504:Ljava/lang/String;- named - UNDERSCORE- Lnet/minecraft/client/gui/widget/EditBoxWidget;UNDERSCORE:Ljava/lang/String;
 
- 
FOCUSED_BOX_TEXT_COLORprivate static final int FOCUSED_BOX_TEXT_COLOR- See Also:
- Mappings:
- Namespace - Name - Mixin selector - official - d- Lepy;d:I- intermediary - field_39505- Lnet/minecraft/class_7529;field_39505:I- named - FOCUSED_BOX_TEXT_COLOR- Lnet/minecraft/client/gui/widget/EditBoxWidget;FOCUSED_BOX_TEXT_COLOR:I
 
- 
UNFOCUSED_BOX_TEXT_COLORprivate static final int UNFOCUSED_BOX_TEXT_COLOR- See Also:
- Mappings:
- Namespace - Name - Mixin selector - official - e- Lepy;e:I- intermediary - field_39506- Lnet/minecraft/class_7529;field_39506:I- named - UNFOCUSED_BOX_TEXT_COLOR- Lnet/minecraft/client/gui/widget/EditBoxWidget;UNFOCUSED_BOX_TEXT_COLOR:I
 
- 
textRenderer- Mappings:
- Namespace - Name - Mixin selector - official - f- Lepy;f:Leov;- intermediary - field_39507- Lnet/minecraft/class_7529;field_39507:Lnet/minecraft/class_327;- named - textRenderer- Lnet/minecraft/client/gui/widget/EditBoxWidget;textRenderer:Lnet/minecraft/client/font/TextRenderer;
 
- 
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 - official - g- Lepy;g:Lsw;- intermediary - field_39508- Lnet/minecraft/class_7529;field_39508:Lnet/minecraft/class_2561;- named - placeholder- Lnet/minecraft/client/gui/widget/EditBoxWidget;placeholder:Lnet/minecraft/text/Text;
 
- 
editBox- Mappings:
- Namespace - Name - Mixin selector - official - h- Lepy;h:Leqb;- intermediary - field_39509- Lnet/minecraft/class_7529;field_39509:Lnet/minecraft/class_7530;- named - editBox- Lnet/minecraft/client/gui/widget/EditBoxWidget;editBox:Lnet/minecraft/client/gui/EditBox;
 
- 
tickprivate int tick- Mappings:
- Namespace - Name - Mixin selector - official - i- Lepy;i:I- intermediary - field_39510- Lnet/minecraft/class_7529;field_39510:I- named - tick- Lnet/minecraft/client/gui/widget/EditBoxWidget;tick:I
 
 
- 
- 
Constructor Details- 
EditBoxWidgetpublic EditBoxWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text placeholder, Text message) - Mappings:
- Namespace - Name - Mixin selector - official - <init>- Lepy;<init>(Leov;IIIILsw;Lsw;)V- intermediary - <init>- Lnet/minecraft/class_7529;<init>(Lnet/minecraft/class_327;IIIILnet/minecraft/class_2561;Lnet/minecraft/class_2561;)V- named - <init>- Lnet/minecraft/client/gui/widget/EditBoxWidget;<init>(Lnet/minecraft/client/font/TextRenderer;IIIILnet/minecraft/text/Text;Lnet/minecraft/text/Text;)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 - official - a- Lepy;a(I)V- intermediary - method_44402- Lnet/minecraft/class_7529;method_44402(I)V- named - setMaxLength- Lnet/minecraft/client/gui/widget/EditBoxWidget;setMaxLength(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 - official - b- Lepy;b(Ljava/util/function/Consumer;)V- intermediary - method_44401- Lnet/minecraft/class_7529;method_44401(Ljava/util/function/Consumer;)V- named - setChangeListener- Lnet/minecraft/client/gui/widget/EditBoxWidget;setChangeListener(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 - official - a- Lepy;a(Ljava/lang/String;)V- intermediary - method_44400- Lnet/minecraft/class_7529;method_44400(Ljava/lang/String;)V- named - setText- Lnet/minecraft/client/gui/widget/EditBoxWidget;setText(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 - official - u- Lepy;u()Ljava/lang/String;- intermediary - method_44405- Lnet/minecraft/class_7529;method_44405()Ljava/lang/String;- named - getText- Lnet/minecraft/client/gui/widget/EditBoxWidget;getText()Ljava/lang/String;
 
- 
tickpublic void tick()- Mappings:
- Namespace - Name - Mixin selector - official - v- Lepy;v()V- intermediary - method_44406- Lnet/minecraft/class_7529;method_44406()V- named - tick- Lnet/minecraft/client/gui/widget/EditBoxWidget;tick()V
 
- 
appendClickableNarrations- Specified by:
- appendClickableNarrationsin class- ClickableWidget
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lepf;a(Lesp;)V- intermediary - method_47399- Lnet/minecraft/class_339;method_47399(Lnet/minecraft/class_6382;)V- named - appendClickableNarrations- Lnet/minecraft/client/gui/widget/ClickableWidget;appendClickableNarrations(Lnet/minecraft/client/gui/screen/narration/NarrationMessageBuilder;)V
 
- 
mouseClickedpublic boolean mouseClicked(double mouseX, double mouseY, int button) Callback for when a mouse button down event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
- mouseClickedin interface- Element
- Overrides:
- mouseClickedin class- ScrollableWidget
- Parameters:
- mouseX- the X coordinate of the mouse
- mouseY- the Y coordinate of the mouse
- button- the mouse button number
- Returns:
- trueto indicate that the event handling is successful/valid
- See Also:
- Mappings:
- Namespace - Name - Mixin selector - official - a- Leqt;a(DDI)Z- intermediary - method_25402- Lnet/minecraft/class_364;method_25402(DDI)Z- named - mouseClicked- Lnet/minecraft/client/gui/Element;mouseClicked(DDI)Z
 
- 
mouseDraggedpublic boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) Callback for when a mouse button drag event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
- mouseDraggedin interface- Element
- Overrides:
- mouseDraggedin class- ScrollableWidget
- Parameters:
- mouseX- the current X coordinate of the mouse
- mouseY- the current Y coordinate of the mouse
- button- the mouse button number
- deltaX- the difference of the current X with the previous X coordinate
- deltaY- the difference of the current Y with the previous Y coordinate
- Returns:
- trueto indicate that the event handling is successful/valid
- See Also:
- Mappings:
- Namespace - Name - Mixin selector - official - a- Leqt;a(DDIDD)Z- intermediary - method_25403- Lnet/minecraft/class_364;method_25403(DDIDD)Z- named - mouseDragged- Lnet/minecraft/client/gui/Element;mouseDragged(DDIDD)Z
 
- 
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- ScrollableWidget
- 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 - official - a- Leqt;a(III)Z- intermediary - method_25404- Lnet/minecraft/class_364;method_25404(III)Z- named - keyPressed- Lnet/minecraft/client/gui/Element;keyPressed(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 - official - a- Leqt;a(CI)Z- intermediary - method_25400- Lnet/minecraft/class_364;method_25400(CI)Z- named - charTyped- Lnet/minecraft/client/gui/Element;charTyped(CI)Z
 
- 
renderContentsRenders the scrolled contents. Subclasses must override this. The rendered contents may overflow; the caller should trim those usingDrawContext.enableScissor(int, int, int, int).- Specified by:
- renderContentsin class- ScrollableWidget
- Mappings:
- Namespace - Name - Mixin selector - official - c- Lepb;c(Leox;IIF)V- intermediary - method_44389- Lnet/minecraft/class_7528;method_44389(Lnet/minecraft/class_332;IIF)V- named - renderContents- Lnet/minecraft/client/gui/widget/ScrollableWidget;renderContents(Lnet/minecraft/client/gui/DrawContext;IIF)V
 
- 
renderOverlayRenders overlays that are not scrolled but part of the widget.This renders the scrollbar by default. Subclasses can override this to render other overlays, but supercall is necessary to make sure the scrollbar renders when it should.- Overrides:
- renderOverlayin class- ScrollableWidget
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lepb;a(Leox;)V- intermediary - method_44384- Lnet/minecraft/class_7528;method_44384(Lnet/minecraft/class_332;)V- named - renderOverlay- Lnet/minecraft/client/gui/widget/ScrollableWidget;renderOverlay(Lnet/minecraft/client/gui/DrawContext;)V
 
- 
getContentsHeightpublic int getContentsHeight()Returns the total height of the contents.- Specified by:
- getContentsHeightin class- ScrollableWidget
- Returns:
- the total height of the contents
- Mappings:
- Namespace - Name - Mixin selector - official - f- Lepb;f()I- intermediary - method_44391- Lnet/minecraft/class_7528;method_44391()I- named - getContentsHeight- Lnet/minecraft/client/gui/widget/ScrollableWidget;getContentsHeight()I
 
- 
overflowsprotected boolean overflows()Returns whether the contents overflow and needs a scrollbar.- Overrides:
- overflowsin class- ScrollableWidget
- Returns:
- whether the contents overflow and needs a scrollbar
- Mappings:
- Namespace - Name - Mixin selector - official - e- Lepb;e()Z- intermediary - method_44392- Lnet/minecraft/class_7528;method_44392()Z- named - overflows- Lnet/minecraft/client/gui/widget/ScrollableWidget;overflows()Z
 
- 
getDeltaYPerScrollprotected double getDeltaYPerScroll()- Specified by:
- getDeltaYPerScrollin class- ScrollableWidget
- Mappings:
- Namespace - Name - Mixin selector - official - g- Lepb;g()D- intermediary - method_44393- Lnet/minecraft/class_7528;method_44393()D- named - getDeltaYPerScroll- Lnet/minecraft/client/gui/widget/ScrollableWidget;getDeltaYPerScroll()D
 
- 
drawSelection- Mappings:
- Namespace - Name - Mixin selector - official - b- Lepy;b(Leox;IIII)V- intermediary - method_44403- Lnet/minecraft/class_7529;method_44403(Lnet/minecraft/class_332;IIII)V- named - drawSelection- Lnet/minecraft/client/gui/widget/EditBoxWidget;drawSelection(Lnet/minecraft/client/gui/DrawContext;IIII)V
 
- 
onCursorChangeprivate void onCursorChange()- Mappings:
- Namespace - Name - Mixin selector - official - w- Lepy;w()V- intermediary - method_44407- Lnet/minecraft/class_7529;method_44407()V- named - onCursorChange- Lnet/minecraft/client/gui/widget/EditBoxWidget;onCursorChange()V
 
- 
getMaxLinesWithoutOverflowprivate double getMaxLinesWithoutOverflow()Returns the maximum amount of lines the widget can hold without overflowing.- Returns:
- the maximum amount of lines the widget can hold without overflowing
- Mappings:
- Namespace - Name - Mixin selector - official - x- Lepy;x()D- intermediary - method_44408- Lnet/minecraft/class_7529;method_44408()D- named - getMaxLinesWithoutOverflow- Lnet/minecraft/client/gui/widget/EditBoxWidget;getMaxLinesWithoutOverflow()D
 
- 
moveCursorprivate void moveCursor(double mouseX, double mouseY) - Mappings:
- Namespace - Name - Mixin selector - official - f- Lepy;f(DD)V- intermediary - method_44404- Lnet/minecraft/class_7529;method_44404(DD)V- named - moveCursor- Lnet/minecraft/client/gui/widget/EditBoxWidget;moveCursor(DD)V
 
 
-