Class AbstractEditor

java.lang.Object
net.minecraft.client.gui.widget.ClickableWidget
io.github.zhengzhengyiyi.gui.widget.AbstractEditor
All Implemented Interfaces:
net.minecraft.client.gui.Drawable, net.minecraft.client.gui.Element, net.minecraft.client.gui.Narratable, net.minecraft.client.gui.navigation.Navigable, net.minecraft.client.gui.Selectable, net.minecraft.client.gui.widget.Widget
Direct Known Subclasses:
GeneralMultilineEditor, GeneralMultilineEditorCopy, MultilineEditor

public abstract class AbstractEditor extends net.minecraft.client.gui.widget.ClickableWidget
Abstract base class for all editor implementations. Provides common functionality and contract for text editors.
  • Nested Class Summary

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

    net.minecraft.client.gui.Selectable.SelectionType
  • Field Summary

    Fields inherited from class net.minecraft.client.gui.widget.ClickableWidget

    active, alpha, height, hovered, visible, width
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractEditor(int x, int y, int width, int height, net.minecraft.text.Text message)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Ends the current search operation.
    abstract void
    Finds the next search match.
    abstract void
    Finds the previous search match.
    abstract int
    Gets the current search match index (1-based).
    abstract int
    Gets the current cursor position.
    abstract int
    Gets the number of search matches found.
    abstract String
    Gets the current text content of the editor.
    abstract void
    Inserts text at the current cursor position.
    abstract boolean
    Checks if a search is currently active.
    abstract void
    Sets the listener for text change events.
    abstract void
    setCursorPosition(int position)
    Sets the cursor position.
    abstract void
    setEditable(boolean editable)
    Sets whether the editor is editable.
    abstract void
    Sets the text content of the editor.
    abstract void
    Starts a text search with the given query.

    Methods inherited from class net.minecraft.client.gui.widget.ClickableWidget

    appendClickableNarrations, appendDefaultNarrations, appendNarrations, drawScrollableText, drawScrollableText, drawScrollableText, forEachChild, getBottom, getHeight, getMessage, getNarrationMessage, getNarrationMessage, getNavigationFocus, getNavigationOrder, getNavigationPath, getRight, getType, getWidth, getX, getY, isFocused, isHovered, isInteractable, isMouseOver, isSelected, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, onClick, onDrag, onRelease, playClickSound, playDownSound, render, renderWidget, setAlpha, setDimensions, setDimensionsAndPosition, setFocused, setHeight, setMessage, setNavigationOrder, setTooltip, setTooltipDelay, setWidth, setX, setY

    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.Element

    charTyped, getBorder, getFocusedPath, isClickable, keyPressed, keyReleased, mouseMoved, mouseScrolled

    Methods inherited from interface net.minecraft.client.gui.Selectable

    getNarratedParts

    Methods inherited from interface net.minecraft.client.gui.widget.Widget

    setPosition
  • Constructor Details

    • AbstractEditor

      public AbstractEditor(int x, int y, int width, int height, net.minecraft.text.Text message)
  • Method Details

    • getText

      public abstract String getText()
      Gets the current text content of the editor.
      Returns:
      the text content
    • setText

      public abstract void setText(String text)
      Sets the text content of the editor.
      Parameters:
      text - the new text content
    • setEditable

      public abstract void setEditable(boolean editable)
      Sets whether the editor is editable.
      Parameters:
      editable - true if the editor should be editable
    • setChangedListener

      public abstract void setChangedListener(Consumer<String> changedListener)
      Sets the listener for text change events.
      Parameters:
      changedListener - the consumer to call when text changes
    • getCursorPosition

      public abstract int getCursorPosition()
      Gets the current cursor position.
      Returns:
      the cursor position
    • setCursorPosition

      public abstract void setCursorPosition(int position)
      Sets the cursor position.
      Parameters:
      position - the new cursor position
    • insertTextAtCursor

      public abstract void insertTextAtCursor(String text)
      Inserts text at the current cursor position.
      Parameters:
      text - the text to insert
    • startSearch

      public abstract void startSearch(String query)
      Starts a text search with the given query.
      Parameters:
      query - the search query
    • findNext

      public abstract void findNext()
      Finds the next search match.
    • findPrevious

      public abstract void findPrevious()
      Finds the previous search match.
    • endSearch

      public abstract void endSearch()
      Ends the current search operation.
    • isSearching

      public abstract boolean isSearching()
      Checks if a search is currently active.
      Returns:
      true if searching
    • getSearchMatchCount

      public abstract int getSearchMatchCount()
      Gets the number of search matches found.
      Returns:
      the match count
    • getCurrentSearchIndex

      public abstract int getCurrentSearchIndex()
      Gets the current search match index (1-based).
      Returns:
      the current match index