Class Tabs.TabSpec
java.lang.Object
com.trevlar.menukit.api.element.Tabs.TabSpec
- Enclosing class:
Tabs
A tab under construction.
-
Method Summary
Modifier and TypeMethodDescriptionFor a tab added withTabs.addTo(Identifier, Tabs.TabSpec): place it right after the tab with this id.For a tab added withTabs.addTo(Identifier, Tabs.TabSpec): place it right before the tab with this id.body(Supplier<List<PanelElement>> factory) The body as a factory, run each time the menu is built, so the body's elements are fresh and read the current config.body(List<PanelElement> body) The body: elements positioned from the body's top-left.An icondrawSizepx square left of the label,Tabs.ICON_LABEL_GAPfrom it: a standalone square texturetextureSizetexels on a side (a mod's icon read from its jar into aDynamicTexture, say), drawn whole and scaled, asIcon.Builder.texture(Supplier, int)draws it.icon(net.minecraft.resources.Identifier sprite, int drawSize) icon(Supplier, int, int)with a GUI-atlas sprite (textures/gui/sprites) for the picture.id()label(net.minecraft.network.chat.Component label) standIn()Owner only: this tab stands in for one another mod may add.visibleWhen(BooleanSupplier visibleWhen) Read every frame; a change relays out the strip.
-
Method Details
-
id
-
label
-
icon
public Tabs.TabSpec icon(Supplier<@Nullable net.minecraft.resources.Identifier> texture, int textureSize, int drawSize) An icondrawSizepx square left of the label,Tabs.ICON_LABEL_GAPfrom it: a standalone square texturetextureSizetexels on a side (a mod's icon read from its jar into aDynamicTexture, say), drawn whole and scaled, asIcon.Builder.texture(Supplier, int)draws it. Read every frame; null draws nothing and keeps the room, so the tab does not change width while its texture loads. The tab widens by the icon and gap, and in every mode the icon and label are placed as one group. Default: none. -
icon
icon(Supplier, int, int)with a GUI-atlas sprite (textures/gui/sprites) for the picture. -
visibleWhen
Read every frame; a change relays out the strip. Default: always shown. -
body
The body: elements positioned from the body's top-left. For the owner's own tabs. -
body
The body as a factory, run each time the menu is built, so the body's elements are fresh and read the current config. Required for a tab added withTabs.addTo(Identifier, Tabs.TabSpec); fine for the owner's tabs too. -
standIn
Owner only: this tab stands in for one another mod may add. A tab added to the menu with the same id takes this one's place, label and body; with nothing to replace it, the tab shows with a dimmed label and this body, typically a line saying which mod to install.Only the place carries over. The replacement keeps its own
visibleWhen, or always shows if it has none: a stand-in's visibility is about advertising the missing mod (an owner's "hide the companion's tabs" switch), not about the real feature once it is there. -
after
For a tab added withTabs.addTo(Identifier, Tabs.TabSpec): place it right after the tab with this id. -
before
For a tab added withTabs.addTo(Identifier, Tabs.TabSpec): place it right before the tab with this id.
-