Enum Class ControlStyle
- All Implemented Interfaces:
Serializable, Comparable<ControlStyle>, Constable
Visual style for INTERACTIVE controls — currently
Button and
Dropdown/DropdownMulti. Distinct from PanelStyle
because panels (containers) and controls (interactive primitives) are
different architectural categories — a panel that "looks like a button"
miscommunicates that it's clickable, and PanelStyle has no notion of
the per-state sprite swaps (hover, disabled) that vanilla button
rendering needs.
Variants
MK— the existing MenuKit look. Buttons use aPanelStyle.RAISEDbackground with a translucent hover overlay, switch toPanelStyle.INSETwhen pressed andPanelStyle.DARKwhen disabled. Dropdown triggers useRAISED. Default when no style is specified — existing consumers see no change.VANILLA— vanilla Minecraft's button sprite atlas (widget/button,widget/button_highlighted,widget/button_disabled). Square corners, textured gray gradient. Matches the look of vanilla menu screens (Options, Controls, Pause). Hover and pressed both use the highlighted sprite (vanilla doesn't have a separate pressed visual).
Scope
Applied to the interactive control's BACKGROUND only. Text rendering (label color, font, alignment) is unaffected — useMKText for
that. For Dropdown and DropdownMulti, a single
.style(...) on the builder applies to BOTH the trigger and the
popover — VANILLA trigger gets widget/button; VANILLA popover
gets widget/button_disabled (vanilla's darker uniform gray)
so the popover reads as a distinct surface beneath the trigger.
Consumers don't separately style the popover.-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic voidrenderVanillaButton(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height, boolean enabled, boolean hoveredOrPressed) Renders a vanilla button-style background sprite at the given bounds, automatically picking the right sprite per state.static voidrenderVanillaPopoverBackground(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height) Renders a vanilla-styled popover background for an open dropdown (or any future overlay container that should match the VANILLA trigger aesthetic).static voidrenderVanillaPressedOverlay(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height) Phase 18t follow-up — renders the "pressed/engaged" visual overlay for a vanilla-styled control.static ControlStyleReturns the enum constant of this class with the specified name.static ControlStyle[]values()Returns an array containing the constants of this enum class, in the order they are declared.static net.minecraft.resources.IdentifiervanillaButtonSprite(boolean enabled, boolean hoveredOrPressed) Picks the vanilla button sprite for a given interactive state.
-
Enum Constant Details
-
MK
-
VANILLA
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
vanillaButtonSprite
public static net.minecraft.resources.Identifier vanillaButtonSprite(boolean enabled, boolean hoveredOrPressed) Picks the vanilla button sprite for a given interactive state. Disabled takes priority (matches vanilla); otherwise highlighted fires on hover OR pressed (vanilla doesn't distinguish those). -
renderVanillaButton
public static void renderVanillaButton(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height, boolean enabled, boolean hoveredOrPressed) Renders a vanilla button-style background sprite at the given bounds, automatically picking the right sprite per state. Convenience used byButtonandDropdownwhenVANILLAis selected.Wraps
GuiGraphicsExtractor.blitSpritewith the sameRenderPipelines.GUI_TEXTUREDpipeline + white tint vanilla uses. Caller is responsible for any state overlays (the vanilla highlighted sprite IS the hover affordance — no additional overlay needed, unlike the MK path). -
renderVanillaPressedOverlay
public static void renderVanillaPressedOverlay(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height) Phase 18t follow-up — renders the "pressed/engaged" visual overlay for a vanilla-styled control. Drawn on top of the existing button sprite to communicate "this is being pressed (Button) or this control is engaged (Dropdown trigger while popover open)."Two layered effects:
- Inverted inner bevel — vanilla's button sprite has a 1px raised bevel (lighter top/left, darker bottom/right). The overlay swaps those: darker top/left, lighter bottom/right — visually reads as "sunken in."
- Translucent dark fill across the interior — softens the button's brightness, reinforcing the pressed-in reading.
Drawn over the outer 1px frame (untouched) and over the existing sprite's bevel pixels (replaced by the inverted lines). The interior dark overlay covers the gradient region inside the bevel.
-
renderVanillaPopoverBackground
public static void renderVanillaPopoverBackground(net.minecraft.client.gui.GuiGraphicsExtractor graphics, int x, int y, int width, int height) Renders a vanilla-styled popover background for an open dropdown (or any future overlay container that should match the VANILLA trigger aesthetic). Useswidget/button_disabled— vanilla's darker, more uniform gray gradient — so the popover reads as a distinct surface beneath the trigger (widget/button's lighter gradient) without falling back to MK's RAISED panel look (which would be jarring against the vanilla-styled trigger above).9-slice handles the stretch from button-sized sprite to popover-sized region; corners stay crisp, middle stretches uniformly.
-