java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
com.pixelmonmod.pixelmon.quests.client.editor.ui.TextField
All Implemented Interfaces:
net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.layouts.LayoutElement, net.minecraft.client.gui.narration.NarratableEntry, net.minecraft.client.gui.narration.NarrationSupplier

public class TextField extends net.minecraft.client.gui.components.AbstractWidget
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry

    net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.minecraft.client.gui.Font
     
    int
     
    int
    The width of this text field.
    int
     
    int
     

    Fields inherited from class net.minecraft.client.gui.components.AbstractWidget

    active, alpha, focused, hoverOrFocusedStartTime, isHovered, message, MIN_SCROLL_PERIOD, packedFGColor, PERIOD_PER_SCROLLED_PIXEL, tabOrderGroup, tooltip, tooltipMsDelay, UNSET_FG_COLOR, wasHoveredOrFocused, x, y

    Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextField(net.minecraft.client.gui.Font fontRenderer, int xPos, int yPos, int width, int height, int backgroundColour, int borderColour)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    charTyped(char p_146201_1_, int p_146201_2_)
    Call this method from your GuiScreen to process the keys into the textbox
    void
    deleteFromCursor(int p_146175_1_)
    delete the selected text, otherwsie deletes characters from either side of the cursor.
    void
    deleteWords(int p_146177_1_)
    Deletes the specified number of words starting at the cursor position.
    int
    returns the current position of the cursor
    boolean
    get enable drawing background and outline
    int
    returns the maximum number of character that can be contained in this textbox
    int
    getNthWordFromCursor(int p_146187_1_)
    see @getNthNextWordFromPos() params: N, position
    int
    getNthWordFromPos(int p_146183_1_, int p_146183_2_)
    gets the position of the nth word.
    returns the text between the cursor and selectionEnd
    int
    the side of the selection that is not the cursor, may be the same as the cursor
    Returns the contents of the textbox
    boolean
    returns true if this textbox is visible
    int
    returns the width of the textbox depending on if background drawing is enabled
    int
    getWordPosition(int p_146197_1_, int p_146197_2_, boolean p_146197_3_)
     
    boolean
    Getter for the focused field
    boolean
    mouseClicked(double p_146192_1_, double p_146192_2_, int p_146192_3_)
    Args: x, y, buttonClicked
    void
    moveCursorBy(int p_146182_1_)
    Moves the text cursor by a specified number of characters and clears the selection
    void
    renderWidget(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks)
    Draws the textbox
    void
    setBorderColour(int color)
     
    void
    setCanLoseFocus(boolean p_146205_1_)
    if true the textbox can lose focus by clicking elsewhere on the screen
    void
    setCursorPosition(int p_146190_1_)
    sets the position of the cursor to the provided index
    void
    sets the cursors position to after the text
    void
    sets the cursors position to the beginning
    void
    setDisabledTextColour(int p_146204_1_)
     
    void
    setEnableBackgroundDrawing(boolean p_146185_1_)
    enable drawing background and outline
    void
    setEnabled(boolean p_146184_1_)
     
    void
    setFocused(boolean p_146195_1_)
    Sets focus to this gui element
    void
    setMaxStringLength(int p_146203_1_)
     
    void
    setSelectionPos(int p_146199_1_)
    Sets the position of the selection anchor (i.e.
    void
    setText(String p_146180_1_)
    Sets the text of the textbox
    void
    setTextColor(int p_146193_1_)
    Sets the text colour for this textbox (disabled text will not use this colour)
    void
    setVisible(boolean p_146189_1_)
    Sets whether or not this textbox is visible
    void
    Increments the cursor counter
    protected void
    updateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput p_259858_)
     
    void
    writeText(String p_146191_1_)
    replaces selected text, or inserts text at the position on the cursor

    Methods inherited from class net.minecraft.client.gui.components.AbstractWidget

    clearFGColor, clicked, createNarrationMessage, createTooltipPositioner, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getRectangle, getTabOrderGroup, getTooltip, getX, getY, isActive, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseDragged, mouseReleased, narrationPriority, nextFocusPath, onClick, onDrag, onRelease, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setHeight, setMessage, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessage

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    getCurrentFocusPath, keyPressed, keyReleased, mouseMoved, mouseScrolled

    Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement

    setPosition
  • Field Details

    • font

      public final net.minecraft.client.gui.Font font
    • xPosition

      public int xPosition
    • yPosition

      public int yPosition
    • width

      public int width
      The width of this text field.
    • height

      public int height
  • Constructor Details

    • TextField

      public TextField(net.minecraft.client.gui.Font fontRenderer, int xPos, int yPos, int width, int height, int backgroundColour, int borderColour)
  • Method Details

    • updateCursorCounter

      public void updateCursorCounter()
      Increments the cursor counter
    • setText

      public void setText(String p_146180_1_)
      Sets the text of the textbox
    • getText

      public String getText()
      Returns the contents of the textbox
    • getSelectedText

      public String getSelectedText()
      returns the text between the cursor and selectionEnd
    • writeText

      public void writeText(String p_146191_1_)
      replaces selected text, or inserts text at the position on the cursor
    • deleteWords

      public void deleteWords(int p_146177_1_)
      Deletes the specified number of words starting at the cursor position. Negative numbers will delete words left of the cursor.
    • deleteFromCursor

      public void deleteFromCursor(int p_146175_1_)
      delete the selected text, otherwsie deletes characters from either side of the cursor. params: delete num
    • getNthWordFromCursor

      public int getNthWordFromCursor(int p_146187_1_)
      see @getNthNextWordFromPos() params: N, position
    • getNthWordFromPos

      public int getNthWordFromPos(int p_146183_1_, int p_146183_2_)
      gets the position of the nth word. N may be negative, then it looks backwards. params: N, position
    • getWordPosition

      public int getWordPosition(int p_146197_1_, int p_146197_2_, boolean p_146197_3_)
    • moveCursorBy

      public void moveCursorBy(int p_146182_1_)
      Moves the text cursor by a specified number of characters and clears the selection
    • setCursorPosition

      public void setCursorPosition(int p_146190_1_)
      sets the position of the cursor to the provided index
    • setCursorPositionZero

      public void setCursorPositionZero()
      sets the cursors position to the beginning
    • setCursorPositionEnd

      public void setCursorPositionEnd()
      sets the cursors position to after the text
    • charTyped

      public boolean charTyped(char p_146201_1_, int p_146201_2_)
      Call this method from your GuiScreen to process the keys into the textbox
    • mouseClicked

      public boolean mouseClicked(double p_146192_1_, double p_146192_2_, int p_146192_3_)
      Args: x, y, buttonClicked
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      mouseClicked in class net.minecraft.client.gui.components.AbstractWidget
      Returns:
    • renderWidget

      public void renderWidget(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks)
      Draws the textbox
      Specified by:
      renderWidget in class net.minecraft.client.gui.components.AbstractWidget
    • setMaxStringLength

      public void setMaxStringLength(int p_146203_1_)
    • getMaxStringLength

      public int getMaxStringLength()
      returns the maximum number of character that can be contained in this textbox
    • getCursorPosition

      public int getCursorPosition()
      returns the current position of the cursor
    • getEnableBackgroundDrawing

      public boolean getEnableBackgroundDrawing()
      get enable drawing background and outline
    • setEnableBackgroundDrawing

      public void setEnableBackgroundDrawing(boolean p_146185_1_)
      enable drawing background and outline
    • setTextColor

      public void setTextColor(int p_146193_1_)
      Sets the text colour for this textbox (disabled text will not use this colour)
    • setBorderColour

      public void setBorderColour(int color)
    • setDisabledTextColour

      public void setDisabledTextColour(int p_146204_1_)
    • setFocused

      public void setFocused(boolean p_146195_1_)
      Sets focus to this gui element
      Specified by:
      setFocused in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      setFocused in class net.minecraft.client.gui.components.AbstractWidget
    • updateWidgetNarration

      protected void updateWidgetNarration(net.minecraft.client.gui.narration.NarrationElementOutput p_259858_)
      Specified by:
      updateWidgetNarration in class net.minecraft.client.gui.components.AbstractWidget
    • isFocused

      public boolean isFocused()
      Getter for the focused field
      Specified by:
      isFocused in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      isFocused in class net.minecraft.client.gui.components.AbstractWidget
    • setEnabled

      public void setEnabled(boolean p_146184_1_)
    • getSelectionEnd

      public int getSelectionEnd()
      the side of the selection that is not the cursor, may be the same as the cursor
    • getWidth

      public int getWidth()
      returns the width of the textbox depending on if background drawing is enabled
      Specified by:
      getWidth in interface net.minecraft.client.gui.layouts.LayoutElement
      Overrides:
      getWidth in class net.minecraft.client.gui.components.AbstractWidget
    • setSelectionPos

      public void setSelectionPos(int p_146199_1_)
      Sets the position of the selection anchor (i.e. position the selection was started at)
    • setCanLoseFocus

      public void setCanLoseFocus(boolean p_146205_1_)
      if true the textbox can lose focus by clicking elsewhere on the screen
    • getVisible

      public boolean getVisible()
      returns true if this textbox is visible
    • setVisible

      public void setVisible(boolean p_146189_1_)
      Sets whether or not this textbox is visible