Class TabNavigationBar
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.components.tabs.TabNavigationBar
- All Implemented Interfaces:
ContainerEventHandler,GuiEventListener,Renderable,TabOrderedElement,NarratableEntry,NarrationSupplier
public class TabNavigationBar
extends AbstractContainerEventHandler
implements Renderable, NarratableEntry
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creating a TabNavigationBar instance.Nested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
NarratableEntry.NarrationPriority -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final LinearLayoutprivate static final intprivate static final intprivate static final intprivate final ImmutableList<TabButton> private final TabManagerprivate final ImmutableList<Tab> private static final Componentprivate intFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic TabNavigationBar.Builderbuilder(TabManager pTabManager, int pWidth) List<? extends GuiEventListener> children()private TabButtonprivate intprivate intgetNextTabIndex(int pKeycode) Returns the index of the next tab based on the given key code.private intgetNextTabIndex(int pCurrentTabIndex, int pKeyCode) getTabs()booleanisMouseOver(double pMouseX, double pMouseY) Checks if the given mouse coordinates are over the GUI element.booleankeyPressed(int pKeycode) Handles key pressed events.protected voidnarrateListElementPosition(NarrationElementOutput pNarrationElementOutput, TabButton pTabButton) Narrates the position of a list element (tab button).nextFocusPath(FocusNavigationEvent pEvent) Retrieves the next focus path based on the given focus navigation event.voidrender(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) Renders the graphical user interface (GUI) element.voidselectTab(int pIndex, boolean pPlayClickSound) Selects the tab at the specified index.voidsetFocused(boolean pFocused) Sets the focus state of the GUI element.voidsetFocused(GuiEventListener pListener) Sets the focus state of the GUI element.voidsetTabActiveState(int pIndex, boolean pActive) voidsetTabTooltip(int pIndex, Tooltip pTooltip) voidsetWidth(int pWidth) voidupdateNarration(NarrationElementOutput pNarrationElementOutput) Updates the narration output with the current narration information.Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDraggingMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyPressed, keyReleased, mouseClicked, mouseDragged, mouseReleased, mouseScrolledMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getBorderForArrowNavigation, mouseMovedMethods inherited from interface net.minecraft.client.gui.narration.NarratableEntry
getNarratables, isActiveMethods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
NO_TAB
private static final int NO_TAB- See Also:
-
MAX_WIDTH
private static final int MAX_WIDTH- See Also:
-
HEIGHT
private static final int HEIGHT- See Also:
-
MARGIN
private static final int MARGIN- See Also:
-
USAGE_NARRATION
-
layout
-
width
private int width -
tabManager
-
tabs
-
tabButtons
-
-
Constructor Details
-
TabNavigationBar
TabNavigationBar(int pWidth, TabManager pTabManager, Iterable<Tab> pTabs)
-
-
Method Details
-
builder
-
setWidth
public void setWidth(int pWidth) -
isMouseOver
public boolean isMouseOver(double pMouseX, double pMouseY) Checks if the given mouse coordinates are over the GUI element.- Specified by:
isMouseOverin interfaceGuiEventListener- Parameters:
pMouseX- the X coordinate of the mouse.pMouseY- the Y coordinate of the mouse.- Returns:
trueif the mouse is over the GUI element,falseotherwise.
-
setFocused
public void setFocused(boolean pFocused) Sets the focus state of the GUI element.- Specified by:
setFocusedin interfaceContainerEventHandler- Specified by:
setFocusedin interfaceGuiEventListener- Parameters:
pFocused-trueto apply focus,falseto remove focus
-
setFocused
Sets the focus state of the GUI element.- Specified by:
setFocusedin interfaceContainerEventHandler- Overrides:
setFocusedin classAbstractContainerEventHandler- Parameters:
pListener- the focused GUI element.
-
children
- Specified by:
childrenin interfaceContainerEventHandler
-
getTabs
-
narrationPriority
- Specified by:
narrationPriorityin interfaceNarratableEntry
-
updateNarration
Updates the narration output with the current narration information.- Specified by:
updateNarrationin interfaceNarrationSupplier- Parameters:
pNarrationElementOutput- the output to update with narration information.
-
narrateListElementPosition
protected void narrateListElementPosition(NarrationElementOutput pNarrationElementOutput, TabButton pTabButton) Narrates the position of a list element (tab button).- Parameters:
pNarrationElementOutput- the narration output to update.pTabButton- the tab button whose position is being narrated.
-
render
Renders the graphical user interface (GUI) element.- Specified by:
renderin interfaceRenderable- Parameters:
pGuiGraphics- the GuiGraphics object used for rendering.pMouseX- the x-coordinate of the mouse cursor.pMouseY- the y-coordinate of the mouse cursor.pPartialTick- the partial tick time.
-
getRectangle
- Specified by:
getRectanglein interfaceGuiEventListener
-
arrangeElements
public void arrangeElements() -
selectTab
public void selectTab(int pIndex, boolean pPlayClickSound) Selects the tab at the specified index.- Parameters:
pIndex- the index of the tab to select.pPlayClickSound- whether to play a click sound when selecting the tab.
-
setTabActiveState
public void setTabActiveState(int pIndex, boolean pActive) -
setTabTooltip
-
keyPressed
public boolean keyPressed(int pKeycode) Handles key pressed events.- Parameters:
pKeycode- the keycode of the pressed key.- Returns:
trueif the key press was handled,falseotherwise.
-
getNextTabIndex
private int getNextTabIndex(int pKeycode) Returns the index of the next tab based on the given key code.- Parameters:
pKeycode- the keycode of the pressed key.- Returns:
- the index of the next tab, or -1 if no valid tab index is found.
-
getNextTabIndex
private int getNextTabIndex(int pCurrentTabIndex, int pKeyCode) -
currentTabIndex
private int currentTabIndex() -
currentTabButton
-