public class TextField
extends net.minecraft.client.gui.AbstractGui
Modifier and Type | Field and Description |
---|---|
net.minecraft.client.gui.FontRenderer |
font |
int |
height |
int |
width
The width of this text field.
|
int |
xPosition |
int |
yPosition |
Constructor and Description |
---|
TextField(net.minecraft.client.gui.FontRenderer fontRenderer,
int xPos,
int yPos,
int width,
int height,
int backgroundColour,
int borderColour) |
Modifier and Type | Method and 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 |
getCursorPosition()
returns the current position of the cursor
|
boolean |
getEnableBackgroundDrawing()
get enable drawing background and outline
|
int |
getMaxStringLength()
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.
|
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
|
int |
getWordPosition(int p_146197_1_,
int p_146197_2_,
boolean p_146197_3_) |
boolean |
isFocused()
Getter for the focused field
|
void |
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(com.mojang.blaze3d.matrix.MatrixStack matrix,
float mouseX,
float 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 |
setCursorPositionEnd()
sets the cursors position to after the text
|
void |
setCursorPositionZero()
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(java.lang.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 |
updateCursorCounter()
Increments the cursor counter
|
void |
writeText(java.lang.String p_146191_1_)
replaces selected text, or inserts text at the position on the cursor
|
public final net.minecraft.client.gui.FontRenderer font
public int xPosition
public int yPosition
public int width
public int height
public TextField(net.minecraft.client.gui.FontRenderer fontRenderer, int xPos, int yPos, int width, int height, int backgroundColour, int borderColour)
public void updateCursorCounter()
public void setText(java.lang.String p_146180_1_)
public java.lang.String getText()
public java.lang.String getSelectedText()
public void writeText(java.lang.String p_146191_1_)
public void deleteWords(int p_146177_1_)
public void deleteFromCursor(int p_146175_1_)
public int getNthWordFromCursor(int p_146187_1_)
public int getNthWordFromPos(int p_146183_1_, int p_146183_2_)
public int getWordPosition(int p_146197_1_, int p_146197_2_, boolean p_146197_3_)
public void moveCursorBy(int p_146182_1_)
public void setCursorPosition(int p_146190_1_)
public void setCursorPositionZero()
public void setCursorPositionEnd()
public boolean charTyped(char p_146201_1_, int p_146201_2_)
public void mouseClicked(double p_146192_1_, double p_146192_2_, int p_146192_3_)
public void renderWidget(com.mojang.blaze3d.matrix.MatrixStack matrix, float mouseX, float mouseY, float partialTicks)
public void setMaxStringLength(int p_146203_1_)
public int getMaxStringLength()
public int getCursorPosition()
public boolean getEnableBackgroundDrawing()
public void setEnableBackgroundDrawing(boolean p_146185_1_)
public void setTextColor(int p_146193_1_)
public void setBorderColour(int color)
public void setDisabledTextColour(int p_146204_1_)
public void setFocused(boolean p_146195_1_)
public boolean isFocused()
public void setEnabled(boolean p_146184_1_)
public int getSelectionEnd()
public int getWidth()
public void setSelectionPos(int p_146199_1_)
public void setCanLoseFocus(boolean p_146205_1_)
public boolean getVisible()
public void setVisible(boolean p_146189_1_)