Class TabCompleteTextField
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.EditBox
com.pixelmonmod.pixelmon.client.gui.widgets.TabCompleteTextField
- All Implemented Interfaces:
- net.minecraft.client.gui.components.events.GuiEventListener,- net.minecraft.client.gui.components.Renderable,- net.minecraft.client.gui.components.TabOrderedElement,- net.minecraft.client.gui.layouts.LayoutElement,- net.minecraft.client.gui.narration.NarratableEntry,- net.minecraft.client.gui.narration.NarrationSupplier
public class TabCompleteTextField
extends net.minecraft.client.gui.components.EditBox
Created by Jay113355 on 3/31/2020.
- 
Nested Class SummaryNested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntrynet.minecraft.client.gui.narration.NarratableEntry.NarrationPriority
- 
Field SummaryFieldsModifier and TypeFieldDescriptionintprotected intprotected booleanFields inherited from class net.minecraft.client.gui.components.EditBoxBACKWARDS, bordered, canLoseFocus, CURSOR_APPEND_CHARACTER, CURSOR_BLINK_INTERVAL_MS, CURSOR_INSERT_COLOR, CURSOR_INSERT_WIDTH, cursorPos, DEFAULT_TEXT_COLOR, displayPos, filter, focusedTime, font, formatter, FORWARDS, highlightPos, hint, isEditable, maxLength, responder, SPRITES, suggestion, textColor, textColorUneditable, valueFields inherited from class net.minecraft.client.gui.components.AbstractWidgetactive, alpha, focused, height, hoverOrFocusedStartTime, isHovered, message, MIN_SCROLL_PERIOD, packedFGColor, PERIOD_PER_SCROLLED_PIXEL, tabOrderGroup, tooltip, tooltipMsDelay, UNSET_FG_COLOR, visible, wasHoveredOrFocused, width, x, yFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListenerDOUBLE_CLICK_THRESHOLD_MS
- 
Constructor SummaryConstructorsConstructorDescriptionTabCompleteTextField(int componentId, net.minecraft.client.gui.Font fontrendererObj, int x, int y, int par5Width, int par6Height) TabCompleteTextField(int componentId, net.minecraft.client.gui.Font fontrendererObj, int x, int y, int par5Width, int par6Height, Pokemon pokemon) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleancharTyped(char typedChar, int keyCode) Call this method from your GuiScreen to process the keys into the textboxprotected voidcreateCompletionsFor(String leftOfCursor) voidcreateCompletionsForDropDown(String leftOfCursor) Adds the completions generated to a separate list that will only hold an amount set byTabCompleteTranslateableTextField.setDropDownOptionAmount(int).voidfillDropDownWithCompletions(net.minecraft.client.gui.GuiGraphics graphics) Holds the values that keep track of where the y position of the next auto-completion text should render.intgetIndexOfDropDownOptionMouseIsOver(double mouseX, double mouseY) booleanbooleankeyPressed(int key, int scanCode, int modifiers) booleanmouseReleased(double mouseX, double mouseY, int button) intrenderCompletionAsString(net.minecraft.client.gui.GuiGraphics graphics, int optionIndex, int dropDownOptionTextStartX, int dropDownOptionTextStartY) Render one of the completions without any fancy formatting or extra info.voidrenderEditBoxAsDropDown(net.minecraft.client.gui.GuiGraphics graphics) Renders an Edit Box larger to fit extra info.voidrenderWidget(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) voidrenderWidgetWithDropDown(net.minecraft.client.gui.GuiGraphics graphics) Literally a duplicate ofEditBox.renderWidget(GuiGraphics, int, int, float)except that the typed text is not centered and instead kept at the top of the edit box.setCompletions(Collection<String> completions) voidsetFocused(boolean focus) voidsetShowDropDown(boolean show) Turns on or off the rendering of the edit box as a large dropdown showing completions for the typed textprotected TabCompleteTextFieldupdatePosition(int x, int y) Methods inherited from class net.minecraft.client.gui.components.EditBoxcanConsumeInput, createNarrationMessage, deleteChars, deleteWords, getCursorPosition, getHighlighted, getInnerWidth, getMaxLength, getScreenX, getValue, getWordPosition, insertText, isBordered, isMouseOver, isVisible, moveCursor, moveCursorTo, moveCursorToEnd, moveCursorToStart, nextFocusPath, onClick, playDownSound, renderHighlight, setBordered, setCanLoseFocus, setCursorPosition, setEditable, setFilter, setFormatter, setHighlightPos, setHint, setMaxLength, setResponder, setSuggestion, setTextColor, setTextColorUneditable, setValue, setVisible, updateWidgetNarrationMethods inherited from class net.minecraft.client.gui.components.AbstractWidgetclearFGColor, clicked, createTooltipPositioner, defaultButtonNarrationText, getFGColor, getHeight, getMessage, getRectangle, getTabOrderGroup, getTooltip, getWidth, getX, getY, isActive, isFocused, isHovered, isHoveredOrFocused, isValidClickButton, mouseClicked, mouseDragged, narrationPriority, onDrag, onRelease, render, renderScrollingString, renderScrollingString, renderScrollingString, setAlpha, setFGColor, setHeight, setMessage, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, setX, setY, updateNarration, visitWidgets, wrapDefaultNarrationMessageMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListenergetCurrentFocusPath, keyReleased, mouseMoved, mouseScrolledMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElementsetPositionMethods inherited from interface net.minecraft.client.gui.components.Renderablerender
- 
Field Details- 
cache
- 
isCompletingprotected boolean isCompleting
- 
indexprotected int index
- 
idpublic int id
 
- 
- 
Constructor Details- 
TabCompleteTextFieldpublic TabCompleteTextField(int componentId, net.minecraft.client.gui.Font fontrendererObj, int x, int y, int par5Width, int par6Height) 
- 
TabCompleteTextFieldpublic TabCompleteTextField(int componentId, net.minecraft.client.gui.Font fontrendererObj, int x, int y, int par5Width, int par6Height, Pokemon pokemon) 
 
- 
- 
Method Details- 
setCompletions
- 
keyPressedpublic boolean keyPressed(int key, int scanCode, int modifiers) - Specified by:
- keyPressedin interface- net.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
- keyPressedin class- net.minecraft.client.gui.components.EditBox
 
- 
mouseReleasedpublic boolean mouseReleased(double mouseX, double mouseY, int button) - Specified by:
- mouseReleasedin interface- net.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
- mouseReleasedin class- net.minecraft.client.gui.components.AbstractWidget
 
- 
getIndexOfDropDownOptionMouseIsOverpublic int getIndexOfDropDownOptionMouseIsOver(double mouseX, double mouseY) 
- 
charTypedpublic boolean charTyped(char typedChar, int keyCode) Call this method from your GuiScreen to process the keys into the textbox- Specified by:
- charTypedin interface- net.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
- charTypedin class- net.minecraft.client.gui.components.EditBox
- Parameters:
- typedChar-
- keyCode-
 
- 
createCompletionsFor
- 
updatePosition
- 
getShowDropDownpublic boolean getShowDropDown()
- 
setShowDropDownpublic void setShowDropDown(boolean show) Turns on or off the rendering of the edit box as a large dropdown showing completions for the typed text- Parameters:
- show- true or false
 
- 
setFocusedpublic void setFocused(boolean focus) - Specified by:
- setFocusedin interface- net.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
- setFocusedin class- net.minecraft.client.gui.components.EditBox
 
- 
renderWidgetpublic void renderWidget(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) - Overrides:
- renderWidgetin class- net.minecraft.client.gui.components.EditBox
 
- 
renderWidgetWithDropDownpublic void renderWidgetWithDropDown(net.minecraft.client.gui.GuiGraphics graphics) Literally a duplicate ofEditBox.renderWidget(GuiGraphics, int, int, float)except that the typed text is not centered and instead kept at the top of the edit box.- Parameters:
- graphics- The PoseStack matrix
 
- 
renderEditBoxAsDropDownpublic void renderEditBoxAsDropDown(net.minecraft.client.gui.GuiGraphics graphics) Renders an Edit Box larger to fit extra info.Gets the sprite for the Edit Box and then increases its size vertically so that it can fit the completions that this widget is generating for what the user is typing. - Parameters:
- graphics- The PoseStack matrix
 
- 
createCompletionsForDropDownAdds the completions generated to a separate list that will only hold an amount set byTabCompleteTranslateableTextField.setDropDownOptionAmount(int).- Parameters:
- leftOfCursor- The text in the widget
 
- 
fillDropDownWithCompletionspublic void fillDropDownWithCompletions(net.minecraft.client.gui.GuiGraphics graphics) Holds the values that keep track of where the y position of the next auto-completion text should render. Calls a render function for the allowed amount of options to display the text for each auto-complete option.- Parameters:
- graphics- The PoseStack matrix
 
- 
renderCompletionAsStringpublic int renderCompletionAsString(net.minecraft.client.gui.GuiGraphics graphics, int optionIndex, int dropDownOptionTextStartX, int dropDownOptionTextStartY) Render one of the completions without any fancy formatting or extra info.- Parameters:
- graphics- The PoseStack matrix
- optionIndex- which number completion this is, meaning we've rendered optionIndex-1 completions so far
- dropDownOptionTextStartX- The starting x position of the text
- dropDownOptionTextStartY- The starting y position of the text
- Returns:
- the starting y position for the next completion text to render in the drop-down
 
 
-