Class EditBox

java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.EditBox
All Implemented Interfaces:
GuiEventListener, Renderable, TabOrderedElement, LayoutElement, NarratableEntry, NarrationSupplier, IAbstractWidgetExtension

public class EditBox extends AbstractWidget implements Renderable
  • Field Details

    • SPRITES

      private static final WidgetSprites SPRITES
    • BACKWARDS

      public static final int BACKWARDS
      See Also:
    • FORWARDS

      public static final int FORWARDS
      See Also:
    • CURSOR_INSERT_WIDTH

      private static final int CURSOR_INSERT_WIDTH
      See Also:
    • CURSOR_INSERT_COLOR

      private static final int CURSOR_INSERT_COLOR
      See Also:
    • CURSOR_APPEND_CHARACTER

      private static final String CURSOR_APPEND_CHARACTER
      See Also:
    • DEFAULT_TEXT_COLOR

      public static final int DEFAULT_TEXT_COLOR
      See Also:
    • font

      private final Font font
    • value

      private String value
    • maxLength

      private int maxLength
    • bordered

      private boolean bordered
    • canLoseFocus

      private boolean canLoseFocus
    • isEditable

      private boolean isEditable
    • displayPos

      private int displayPos
    • cursorPos

      private int cursorPos
    • highlightPos

      private int highlightPos
    • textColor

      private int textColor
    • textColorUneditable

      private int textColorUneditable
    • suggestion

      @Nullable private String suggestion
    • responder

      @Nullable private Consumer<String> responder
    • filter

      private Predicate<String> filter
    • formatter

    • hint

      @Nullable private Component hint
    • focusedTime

      private long focusedTime
  • Constructor Details

    • EditBox

      public EditBox(Font p_294485_, int p_294264_, int p_295938_, Component p_294624_)
    • EditBox

      public EditBox(Font p_94114_, int p_94115_, int p_94116_, int p_94117_, int p_94118_, Component p_94119_)
    • EditBox

      public EditBox(Font p_94106_, int p_94107_, int p_94108_, int p_94109_, int p_94110_, @Nullable EditBox p_94111_, Component p_94112_)
  • Method Details

    • setResponder

      public void setResponder(Consumer<String> p_94152_)
    • setFormatter

      public void setFormatter(BiFunction<String,Integer,FormattedCharSequence> p_94150_)
    • createNarrationMessage

      protected MutableComponent createNarrationMessage()
      Overrides:
      createNarrationMessage in class AbstractWidget
    • setValue

      public void setValue(String p_94145_)
    • getValue

      public String getValue()
    • getHighlighted

      public String getHighlighted()
    • setFilter

      public void setFilter(Predicate<String> p_94154_)
    • insertText

      public void insertText(String p_94165_)
    • onValueChange

      private void onValueChange(String p_94175_)
    • deleteText

      private void deleteText(int p_94218_)
    • deleteWords

      public void deleteWords(int p_94177_)
    • deleteChars

      public void deleteChars(int p_94181_)
    • getWordPosition

      public int getWordPosition(int p_94185_)
    • getWordPosition

      private int getWordPosition(int p_94129_, int p_94130_)
    • getWordPosition

      private int getWordPosition(int p_94141_, int p_94142_, boolean p_94143_)
    • moveCursor

      public void moveCursor(int p_94189_, boolean p_295737_)
    • getCursorPos

      private int getCursorPos(int p_94221_)
    • moveCursorTo

      public void moveCursorTo(int p_94193_, boolean p_294422_)
    • setCursorPosition

      public void setCursorPosition(int p_94197_)
    • moveCursorToStart

      public void moveCursorToStart(boolean p_295890_)
    • moveCursorToEnd

      public void moveCursorToEnd(boolean p_296224_)
    • keyPressed

      public boolean keyPressed(int p_94132_, int p_94133_, int p_94134_)
      Specified by:
      keyPressed in interface GuiEventListener
    • canConsumeInput

      public boolean canConsumeInput()
    • charTyped

      public boolean charTyped(char p_94122_, int p_94123_)
      Specified by:
      charTyped in interface GuiEventListener
    • onClick

      public void onClick(double p_279417_, double p_279437_)
      Overrides:
      onClick in class AbstractWidget
    • playDownSound

      public void playDownSound(SoundManager p_279245_)
      Overrides:
      playDownSound in class AbstractWidget
    • renderWidget

      public void renderWidget(GuiGraphics p_283252_, int p_281594_, int p_282100_, float p_283101_)
      Specified by:
      renderWidget in class AbstractWidget
    • renderHighlight

      private void renderHighlight(GuiGraphics p_281400_, int p_265338_, int p_265693_, int p_265618_, int p_265584_)
    • setMaxLength

      public void setMaxLength(int p_94200_)
    • getMaxLength

      private int getMaxLength()
    • getCursorPosition

      public int getCursorPosition()
    • isBordered

      public boolean isBordered()
    • setBordered

      public void setBordered(boolean p_94183_)
    • setTextColor

      public void setTextColor(int p_94203_)
    • setTextColorUneditable

      public void setTextColorUneditable(int p_94206_)
    • nextFocusPath

      @Nullable public ComponentPath nextFocusPath(FocusNavigationEvent p_265216_)
      Specified by:
      nextFocusPath in interface GuiEventListener
      Overrides:
      nextFocusPath in class AbstractWidget
    • isMouseOver

      public boolean isMouseOver(double p_94157_, double p_94158_)
      Specified by:
      isMouseOver in interface GuiEventListener
      Overrides:
      isMouseOver in class AbstractWidget
    • setFocused

      public void setFocused(boolean p_265520_)
      Specified by:
      setFocused in interface GuiEventListener
      Overrides:
      setFocused in class AbstractWidget
    • isEditable

      private boolean isEditable()
    • setEditable

      public void setEditable(boolean p_94187_)
    • getInnerWidth

      public int getInnerWidth()
    • setHighlightPos

      public void setHighlightPos(int p_94209_)
    • scrollTo

      private void scrollTo(int p_296429_)
    • setCanLoseFocus

      public void setCanLoseFocus(boolean p_94191_)
    • isVisible

      public boolean isVisible()
    • setVisible

      public void setVisible(boolean p_94195_)
    • setSuggestion

      public void setSuggestion(@Nullable String p_94168_)
    • getScreenX

      public int getScreenX(int p_94212_)
    • updateWidgetNarration

      public void updateWidgetNarration(NarrationElementOutput p_259237_)
      Specified by:
      updateWidgetNarration in class AbstractWidget
    • setHint

      public void setHint(Component p_259584_)