public class GuiTextFieldNew extends net.minecraft.client.gui.Gui implements IGuiEventListener
Modifier and Type | Field and Description |
---|---|
int |
height |
int |
width
The width of this text field.
|
int |
x |
int |
y |
Constructor and Description |
---|
GuiTextFieldNew(int componentId,
net.minecraft.client.gui.FontRenderer fontrendererObj,
int x,
int y,
int par5Width,
int par6Height) |
GuiTextFieldNew(int p_i49853_1_,
net.minecraft.client.gui.FontRenderer p_i49853_2_,
int p_i49853_3_,
int p_i49853_4_,
int p_i49853_5_,
int p_i49853_6_,
GuiTextFieldNew p_i49853_7_) |
Modifier and Type | Method and Description |
---|---|
boolean |
canFocus() |
boolean |
charTyped(char p_charTyped_1_,
int p_charTyped_2_) |
void |
deleteFromCursor(int num)
Deletes the given number of characters from the current cursor's position, unless there is currently a selection, in
which case the selection is deleted instead.
|
void |
deleteWords(int num)
Deletes the given number of words from the current cursor's position, unless there is currently a selection, in which
case the selection is deleted instead.
|
void |
drawTextField(int mouseX,
int mouseY,
float partialTicks) |
void |
focusChanged(boolean focused) |
int |
func_195611_j(int p_195611_1_) |
void |
func_212422_f(int p_212422_1_) |
int |
getCursorPosition()
returns the current position of the cursor
|
boolean |
getEnableBackgroundDrawing()
Gets whether the background and outline of this text box should be drawn (true if so).
|
int |
getMaxStringLength()
returns the maximum number of character that can be contained in this textbox
|
int |
getNthWordFromCursor(int numWords)
Gets the starting index of the word at the specified number of words away from the cursor position.
|
int |
getNthWordFromPos(int n,
int pos)
Gets the starting index of the word at a distance of the specified number of words away from the given position.
|
int |
getNthWordFromPosWS(int n,
int pos,
boolean skipWs)
Like getNthWordFromPos (which wraps this), but adds option for skipping consecutive spaces
|
java.lang.String |
getSelectedText()
returns the text between the cursor and selectionEnd
|
int |
getSelectionEnd()
the side of the selection that is not the cursor, may be the same as the cursor
|
java.lang.String |
getText()
Returns the contents of the textbox
|
boolean |
getVisible()
returns true if this textbox is visible
|
int |
getWidth()
returns the width of the textbox depending on if background drawing is enabled
|
boolean |
isFocused()
Getter for the focused field
|
boolean |
keyPressed(int keyCode,
int p_keyPressed_2_,
int p_keyPressed_3_) |
boolean |
mouseClicked(double p_mouseClicked_1_,
double p_mouseClicked_3_,
int p_mouseClicked_5_) |
void |
moveCursorBy(int num)
Moves the text cursor by a specified number of characters and clears the selection
|
void |
setCanLoseFocus(boolean canLoseFocusIn)
Sets whether this text box loses focus when something other than it is clicked.
|
void |
setCursorPosition(int pos)
Sets the current position of the cursor.
|
void |
setCursorPositionEnd()
Moves the cursor to the very end of this text box.
|
void |
setCursorPositionZero()
Moves the cursor to the very start of this text box.
|
void |
setDisabledTextColour(int color)
Sets the color to use for text in this text box when this text box is disabled.
|
void |
setEnableBackgroundDrawing(boolean enableBackgroundDrawingIn)
Sets whether or not the background and outline of this text box should be drawn.
|
void |
setEnabled(boolean enabled)
Sets whether this text box is enabled.
|
void |
setFocused(boolean isFocusedIn)
Sets focus to this gui element
|
void |
setMaxStringLength(int length)
Sets the maximum length for the text in this text box.
|
void |
setResponderEntryValue(int idIn,
java.lang.String textIn)
Notifies this text box's responder that the text has changed.
|
void |
setSelectionPos(int position)
Sets the position of the selection anchor (the selection anchor and the cursor position mark the edges of the
selection).
|
void |
setSuggestion(java.lang.String p_195612_1_) |
void |
setText(java.lang.String textIn)
Sets the text of the textbox, and moves the cursor to the end.
|
void |
setTextAcceptHandler(java.util.function.BiConsumer<java.lang.Integer,java.lang.String> p_195609_1_) |
void |
setTextColor(int color)
Sets the color to use when drawing this text box's text.
|
void |
setTextFormatter(java.util.function.BiFunction<java.lang.String,java.lang.Integer,java.lang.String> p_195607_1_) |
void |
setValidator(java.util.function.Predicate<java.lang.String> p_200675_1_) |
void |
setVisible(boolean isVisible)
Sets whether or not this textbox is visible
|
void |
tick()
Increments the cursor counter
|
void |
writeText(java.lang.String textToWrite)
Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
|
drawCenteredString, drawGradientRect, drawHorizontalLine, drawModalRectWithCustomSizedTexture, drawRect, drawScaledCustomSizeModalRect, drawString, drawTexturedModalRect, drawTexturedModalRect, drawTexturedModalRect, drawVerticalLine
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
keyReleased, mouseDragged, mouseReleased, mouseScrolled
public int x
public int y
public int width
public int height
public GuiTextFieldNew(int componentId, net.minecraft.client.gui.FontRenderer fontrendererObj, int x, int y, int par5Width, int par6Height)
public GuiTextFieldNew(int p_i49853_1_, net.minecraft.client.gui.FontRenderer p_i49853_2_, int p_i49853_3_, int p_i49853_4_, int p_i49853_5_, int p_i49853_6_, @Nullable GuiTextFieldNew p_i49853_7_)
public void setTextAcceptHandler(java.util.function.BiConsumer<java.lang.Integer,java.lang.String> p_195609_1_)
public void setTextFormatter(java.util.function.BiFunction<java.lang.String,java.lang.Integer,java.lang.String> p_195607_1_)
public void tick()
public void setText(java.lang.String textIn)
public java.lang.String getText()
public java.lang.String getSelectedText()
public void setValidator(java.util.function.Predicate<java.lang.String> p_200675_1_)
public void writeText(java.lang.String textToWrite)
public void setResponderEntryValue(int idIn, java.lang.String textIn)
public void deleteWords(int num)
public void deleteFromCursor(int num)
public int getNthWordFromCursor(int numWords)
public int getNthWordFromPos(int n, int pos)
public int getNthWordFromPosWS(int n, int pos, boolean skipWs)
public void moveCursorBy(int num)
public void setCursorPosition(int pos)
public void func_212422_f(int p_212422_1_)
public void setCursorPositionZero()
public void setCursorPositionEnd()
public boolean keyPressed(int keyCode, int p_keyPressed_2_, int p_keyPressed_3_)
keyPressed
in interface IGuiEventListener
public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_)
charTyped
in interface IGuiEventListener
public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_)
mouseClicked
in interface IGuiEventListener
public void drawTextField(int mouseX, int mouseY, float partialTicks)
public void setMaxStringLength(int length)
public int getMaxStringLength()
public int getCursorPosition()
public boolean getEnableBackgroundDrawing()
public void setEnableBackgroundDrawing(boolean enableBackgroundDrawingIn)
public void setTextColor(int color)
public void setDisabledTextColour(int color)
public void focusChanged(boolean focused)
focusChanged
in interface IGuiEventListener
public boolean canFocus()
canFocus
in interface IGuiEventListener
public void setFocused(boolean isFocusedIn)
public boolean isFocused()
public void setEnabled(boolean enabled)
public int getSelectionEnd()
public int getWidth()
public void setSelectionPos(int position)
public void setCanLoseFocus(boolean canLoseFocusIn)
public boolean getVisible()
public void setVisible(boolean isVisible)
public void setSuggestion(@Nullable java.lang.String p_195612_1_)
public int func_195611_j(int p_195611_1_)