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
ConstructorsConstructorDescriptionAbstractEditor(int x, int y, int width, int height, net.minecraft.text.Text message) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidEnds the current search operation.abstract voidfindNext()Finds the next search match.abstract voidFinds the previous search match.abstract intGets the current search match index (1-based).abstract intGets the current cursor position.abstract intGets the number of search matches found.abstract StringgetText()Gets the current text content of the editor.abstract voidinsertTextAtCursor(String text) Inserts text at the current cursor position.abstract booleanChecks if a search is currently active.abstract voidsetChangedListener(Consumer<String> changedListener) Sets the listener for text change events.abstract voidsetCursorPosition(int position) Sets the cursor position.abstract voidsetEditable(boolean editable) Sets whether the editor is editable.abstract voidSets the text content of the editor.abstract voidstartSearch(String query) 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, setYMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
charTyped, getBorder, getFocusedPath, isClickable, keyPressed, keyReleased, mouseMoved, mouseScrolledMethods inherited from interface net.minecraft.client.gui.Selectable
getNarratedPartsMethods 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
Gets the current text content of the editor.- Returns:
- the text content
-
setText
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
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
Inserts text at the current cursor position.- Parameters:
text- the text to insert
-
startSearch
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
-