Class MultiLineEditBox
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractScrollWidget
net.minecraft.client.gui.components.MultiLineEditBox
- All Implemented Interfaces:
GuiEventListener
,Renderable
,TabOrderedElement
,LayoutElement
,NarratableEntry
,NarrationSupplier
,IAbstractWidgetExtension
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final int
private static final int
private static final int
private long
private final Font
private final Component
private static final int
private static final int
private final MultilineTextField
Fields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, packedFGColor, UNSET_FG_COLOR, visible, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorsConstructorDescriptionMultiLineEditBox
(Font font, int x, int y, int width, int height, Component placeholder, Component message) -
Method Summary
Modifier and TypeMethodDescriptionboolean
charTyped
(char codePoint, int modifiers) Called when a character is typed within the GUI element.private double
int
getValue()
boolean
keyPressed
(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.boolean
mouseClicked
(double mouseX, double mouseY, int button) Called when a mouse button is clicked within the GUI element.boolean
mouseDragged
(double mouseX, double mouseY, int button, double dragX, double dragY) Called when the mouse is dragged within the GUI element.protected void
renderContents
(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) protected void
renderDecorations
(GuiGraphics guiGraphics) private void
renderHighlight
(GuiGraphics guiGraphics, int minX, int minY, int maxX, int maxY) protected boolean
protected double
private void
private void
seekCursorScreen
(double mouseX, double mouseY) void
setCharacterLimit
(int characterLimit) void
setFocused
(boolean focused) Sets the focus state of the GUI element.void
void
setValueListener
(Consumer<String> valueListener) void
updateWidgetNarration
(NarrationElementOutput narrationElementOutput) Methods inherited from class net.minecraft.client.gui.components.AbstractScrollWidget
getMaxScrollAmount, innerPadding, mouseReleased, mouseScrolled, renderBackground, renderBorder, renderWidget, scrollAmount, scrollbarWidth, setScrollAmount, totalInnerPadding, withinContentAreaPoint, withinContentAreaTopBottom
Methods inherited from class net.minecraft.client.gui.components.AbstractWidget
clearFGColor, clicked, createNarrationMessage, defaultButtonNarrationText, getBottom, getFGColor, getHeight, getMessage, getRectangle, getRight, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, narrationPriority, nextFocusPath, onClick, onDrag, onRelease, playDownSound, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setHeight, setMessage, setRectangle, setSize, 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, getRectangle, isFocused, isMouseOver, keyReleased, mouseMoved, nextFocusPath
Methods inherited from interface net.neoforged.neoforge.client.extensions.IAbstractWidgetExtension
onClick
Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPosition
Methods inherited from interface net.minecraft.client.gui.components.Renderable
render
Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
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
- See Also:
-
TEXT_COLOR
private static final int TEXT_COLOR- See Also:
-
PLACEHOLDER_TEXT_COLOR
private static final int PLACEHOLDER_TEXT_COLOR- See Also:
-
CURSOR_BLINK_INTERVAL_MS
private static final int CURSOR_BLINK_INTERVAL_MS- See Also:
-
font
-
placeholder
-
textField
-
focusedTime
private long focusedTime
-
-
Constructor Details
-
MultiLineEditBox
-
-
Method Details
-
setCharacterLimit
public void setCharacterLimit(int characterLimit) -
setValueListener
-
setValue
-
getValue
-
updateWidgetNarration
- Specified by:
updateWidgetNarration
in classAbstractWidget
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button) Description copied from class:AbstractWidget
Called when a mouse button is clicked within the GUI element.- Specified by:
mouseClicked
in interfaceGuiEventListener
- Overrides:
mouseClicked
in classAbstractScrollWidget
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) Description copied from class:AbstractWidget
Called when the mouse is dragged within the GUI element.- Specified by:
mouseDragged
in interfaceGuiEventListener
- Overrides:
mouseDragged
in classAbstractScrollWidget
- Parameters:
mouseX
- the X coordinate of the mouse.mouseY
- the Y coordinate of the mouse.button
- the button that is being dragged.dragX
- the X distance of the drag.dragY
- the Y distance of the drag.- Returns:
true
if the event is consumed,false
otherwise.
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) Called when a keyboard key is pressed within the GUI element.- Specified by:
keyPressed
in interfaceGuiEventListener
- Overrides:
keyPressed
in classAbstractScrollWidget
- Parameters:
keyCode
- the key code of the pressed key.scanCode
- the scan code of the pressed key.modifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
charTyped
public boolean charTyped(char codePoint, int modifiers) Called when a character is typed within the GUI element.- Parameters:
codePoint
- the code point of the typed character.modifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
renderContents
- Specified by:
renderContents
in classAbstractScrollWidget
-
renderDecorations
- Overrides:
renderDecorations
in classAbstractScrollWidget
-
getInnerHeight
public int getInnerHeight()- Specified by:
getInnerHeight
in classAbstractScrollWidget
-
scrollbarVisible
protected boolean scrollbarVisible()- Overrides:
scrollbarVisible
in classAbstractScrollWidget
-
scrollRate
protected double scrollRate()- Specified by:
scrollRate
in classAbstractScrollWidget
-
renderHighlight
-
scrollToCursor
private void scrollToCursor() -
getDisplayableLineCount
private double getDisplayableLineCount() -
seekCursorScreen
private void seekCursorScreen(double mouseX, double mouseY) -
setFocused
public void setFocused(boolean focused) Sets the focus state of the GUI element.- Specified by:
setFocused
in interfaceGuiEventListener
- Overrides:
setFocused
in classAbstractWidget
- Parameters:
focused
-true
to apply focus,false
to remove focus
-