Class ExtensibleTextFieldWidget
java.lang.Object
net.minecraft.client.gui.DrawContext
net.glasslauncher.mods.api.gcapi.screen.widget.ExtensibleTextFieldWidget
- All Implemented Interfaces:
HasDrawable,HasToolTip
public class ExtensibleTextFieldWidget
extends net.minecraft.client.gui.DrawContext
implements HasDrawable, HasToolTip
Basically a modified Textbox from r1.2.5, but modified for gcapi's use case.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintintintFields inherited from class net.minecraft.client.gui.DrawContext
zOffset -
Constructor Summary
ConstructorsConstructorDescriptionExtensibleTextFieldWidget(net.minecraft.client.font.TextRenderer textRenderer) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddraw(int mouseX, int mouseY) Use this to render your drawable on the screen.intintintintgetText()The tooltip to show, can be multiline by adding another element onto the list.int[]getXYWH()The position and size of your element.booleanbooleanbooleanvoidkeyPressed(char c, int i) Called whenever a key is pressed.voidmethod_729(int i) intmethod_730(int i, int j) voidmethod_735(int i) intmethod_739(int i) voidmouseClicked(int mouseX, int mouseY, int button) Note: This is called any time the mouse is clicked.voidvoidsetEnabled(boolean flag) voidsetID(int id) Called when the config category is adding the drawable.voidsetMaxLength(int i) voidsetSelected(boolean flag) voidsetShouldDrawBackground(boolean flag) voidvoidsetValidator(Function<String, uk.co.benjiweber.expressions.tuple.BiTuple<Boolean, List<String>>> contentsValidator) voidsetXYWH(int x, int y, int width, int height) Called when setting the drawable position.booleanvoidtick()Called every frame.voidvoidupdateCursorMax(int cursorMax) voidupdateCursorPosition(int newCursorPos) voidupdateOffsetCursorMax(int cursorMax) Methods inherited from class net.minecraft.client.gui.DrawContext
drawCenteredTextWithShadow, drawHorizontalLine, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient
-
Field Details
-
selectedTextColour
public int selectedTextColour -
deselectedTextColour
public int deselectedTextColour -
errorBorderColour
public int errorBorderColour
-
-
Constructor Details
-
ExtensibleTextFieldWidget
public ExtensibleTextFieldWidget(net.minecraft.client.font.TextRenderer textRenderer)
-
-
Method Details
-
isValueValid
public boolean isValueValid() -
tick
public void tick()Description copied from interface:HasDrawableCalled every frame.- Specified by:
tickin interfaceHasDrawable
-
setText
-
getText
-
getSelectedText
-
addText
-
method_729
public void method_729(int i) -
method_735
public void method_735(int i) -
method_739
public int method_739(int i) -
method_730
public int method_730(int i, int j) -
updateOffsetCursorMax
public void updateOffsetCursorMax(int cursorMax) -
updateCursorMax
public void updateCursorMax(int cursorMax) -
updateCursorMax
public void updateCursorMax() -
onTextChanged
public void onTextChanged() -
keyPressed
public void keyPressed(char c, int i) Description copied from interface:HasDrawableCalled whenever a key is pressed.- Specified by:
keyPressedin interfaceHasDrawable
-
setID
public void setID(int id) Description copied from interface:HasDrawableCalled when the config category is adding the drawable.- Specified by:
setIDin interfaceHasDrawable
-
mouseClicked
public void mouseClicked(int mouseX, int mouseY, int button) Description copied from interface:HasDrawableNote: This is called any time the mouse is clicked. Check the button ID if you want to only do stuff with your button.- Specified by:
mouseClickedin interfaceHasDrawable
-
setXYWH
public void setXYWH(int x, int y, int width, int height) Description copied from interface:HasDrawableCalled when setting the drawable position. X and Y is the top left corner.- Specified by:
setXYWHin interfaceHasDrawable
-
getTooltip
Description copied from interface:HasToolTipThe tooltip to show, can be multiline by adding another element onto the list.- Specified by:
getTooltipin interfaceHasToolTip- Returns:
- a List of colour-enabled strings to use as a tooltip.
-
getXYWH
public int[] getXYWH()Description copied from interface:HasToolTipThe position and size of your element. Required.- Specified by:
getXYWHin interfaceHasToolTip- Returns:
- a 4 length array of ints, the X position, Y position, width and height of your element.
-
draw
public void draw(int mouseX, int mouseY) Description copied from interface:HasDrawableUse this to render your drawable on the screen.- Specified by:
drawin interfaceHasDrawable
-
setMaxLength
public void setMaxLength(int i) -
getMaxLength
public int getMaxLength() -
getCursorMax
public int getCursorMax() -
shouldDrawBackground
public boolean shouldDrawBackground() -
setShouldDrawBackground
public void setShouldDrawBackground(boolean flag) -
setSelected
public void setSelected(boolean flag) -
isSelected
public boolean isSelected() -
getCursorMin
public int getCursorMin() -
getBackgroundOffset
public int getBackgroundOffset() -
updateCursorPosition
public void updateCursorPosition(int newCursorPos) -
setEnabled
public void setEnabled(boolean flag) -
isEnabled
public boolean isEnabled() -
setValidator
-