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 NarratableEntry, Renderable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creating a TabNavigationBar instance.Nested classes/interfaces inherited from interface 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 int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTabNavigationBar(int width, TabManager tabManager, Iterable<Tab> tabs) -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic TabNavigationBar.Builderbuilder(TabManager tabManager, int width) List<? extends GuiEventListener> children()private @Nullable TabButtonprivate intprivate intgetNextTabIndex(int currentTab, KeyEvent event) private intgetNextTabIndex(KeyEvent event) getTabs()booleanisMouseOver(double mouseX, double mouseY) Checks if the given mouse coordinates are over the GUI element.booleankeyPressed(KeyEvent event) protected voidnarrateListElementPosition(NarrationElementOutput output, TabButton widget) Narrates the position of a list element (tab button).@Nullable ComponentPathnextFocusPath(FocusNavigationEvent navigationEvent) Retrieves the next focus path based on the given focus navigation event.voidrender(GuiGraphics graphics, int mouseX, int mouseY, float a) Renders the graphical user interface (GUI) element.voidselectTab(int index, boolean playSound) Selects the tab at the specified index.voidsetFocused(boolean focused) Sets the focus state of the GUI element.voidsetFocused(@Nullable GuiEventListener focused) Sets the focus state of the GUI element.voidsetTabActiveState(int index, boolean active) voidsetTabTooltip(int index, @Nullable Tooltip hint) voidUpdates the narration output with the current narration information.voidupdateWidth(int width) Methods inherited from class AbstractContainerEventHandler
getFocused, isDragging, setDraggingMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContainerEventHandler
charTyped, getBorderForArrowNavigation, getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseClicked, mouseDragged, mouseReleased, mouseScrolledMethods inherited from interface GuiEventListener
mouseMoved, shouldTakeFocusAfterInteractionMethods inherited from interface NarratableEntry
getNarratables, isActiveMethods inherited from interface 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
-
-
Method Details
-
builder
-
updateWidth
public void updateWidth(int width) -
isMouseOver
public boolean isMouseOver(double mouseX, double mouseY) Description copied from interface:GuiEventListenerChecks if the given mouse coordinates are over the GUI element.- Specified by:
isMouseOverin interfaceGuiEventListener- Parameters:
mouseX- the X coordinate of the mouse.mouseY- the Y coordinate of the mouse.- Returns:
trueif the mouse is over the GUI element,falseotherwise.
-
setFocused
public void setFocused(boolean focused) Sets the focus state of the GUI element.- Specified by:
setFocusedin interfaceContainerEventHandler- Specified by:
setFocusedin interfaceGuiEventListener- Parameters:
focused-trueto apply focus,falseto remove focus
-
setFocused
Sets the focus state of the GUI element.- Specified by:
setFocusedin interfaceContainerEventHandler- Overrides:
setFocusedin classAbstractContainerEventHandler- Parameters:
focused- 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:
output- the output to update with narration information.
-
narrateListElementPosition
Narrates the position of a list element (tab button).- Parameters:
output- the narration output to update.widget- the tab button whose position is being narrated.
-
render
Renders the graphical user interface (GUI) element.- Specified by:
renderin interfaceRenderable- Parameters:
graphics- the GuiGraphics object used for rendering.mouseX- the x-coordinate of the mouse cursor.mouseY- the y-coordinate of the mouse cursor.a- the partial tick time.
-
getRectangle
- Specified by:
getRectanglein interfaceGuiEventListener
-
arrangeElements
public void arrangeElements() -
selectTab
public void selectTab(int index, boolean playSound) Selects the tab at the specified index.- Parameters:
index- the index of the tab to select.playSound- whether to play a click sound when selecting the tab.
-
setTabActiveState
public void setTabActiveState(int index, boolean active) -
setTabTooltip
-
keyPressed
- Specified by:
keyPressedin interfaceContainerEventHandler- Specified by:
keyPressedin interfaceGuiEventListener
-
getNextTabIndex
-
getNextTabIndex
-
currentTabIndex
private int currentTabIndex() -
currentTabButton
-