Enum Class ScreenKind

java.lang.Object
java.lang.Enum<ScreenKind>
com.trevlar.menukit.api.panel.ScreenKind
All Implemented Interfaces:
Serializable, Comparable<ScreenKind>, Constable

public enum ScreenKind extends Enum<ScreenKind>
The look of the screen an element is on, which decides how it draws (6.1.0; renamed in 7.3.0). There is one set of elements; each draws itself for the look of the screen it is on. No element, panel or screen picks a look any other way.
  • PANEL, the Panel look: inventories, chests, anything built on vanilla's AbstractContainerScreen. MenuKit's own look: raised gray controls on a light gray panel, dark text without a shadow.
  • DEFAULT, the Default look: the screens reached from the pause menu and the title screen (vanilla's Options, Video Settings, Controls, Create World). Vanilla's look there: its stone buttons, checkbox, tab and slot sprites, white text with a shadow, its separators and darker list background, over the blurred world or the panorama.

Renamed in 7.3.0

The looks were OPTIONS (now DEFAULT) and CONTAINER (now PANEL). The old names stay until 8.0.0 as deprecated aliases: static fields holding the same two constants, so a mod built against 7.2.0 keeps working, and ScreenKind.OPTIONS == ScreenKind.DEFAULT. They are not enum constants: values() lists only the two looks, and a switch names the new ones.

Where the look comes from (of(Screen))

  • A panel injected into a vanilla screen: the host knows. A vanilla AbstractContainerScreen has the Panel look, any other vanilla screen the Default look, so a panel on Controls gets the Default look with no code.
  • An anchor's panels: the look of the screen the anchor is on.
  • A standalone MKScreen: the look it declared when it was created (super(title, ScreenKind.DEFAULT, panels)), PANEL when it declared none, which is how every standalone screen looked before 6.1.0.
  • The HUD: PANEL, the look it has always had.
  • A dialog or overlay follows the screen it opens on, since it is a panel on that screen; so does the dialog an ItemPicker opens.

What the look changes

Drawing only, never size or behavior: a panel's background, every control's sprite and every text color. A piece with no vanilla twin (a radio button, a color swatch, an info box, a consumer's own sprite) keeps MenuKit's drawing in both looks; only its text follows the look.
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The Default look: vanilla's Options, Controls, Create World and the like.
    The Panel look: inventories, chests, anything built on AbstractContainerScreen.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ScreenKind
    Deprecated, for removal: This API element is subject to removal in a future version.
    Renamed PANEL in 7.3.0; removed in 8.0.0.
    static final ScreenKind
    Deprecated, for removal: This API element is subject to removal in a future version.
    Renamed DEFAULT in 7.3.0; removed in 8.0.0.
  • Method Summary

    Modifier and Type
    Method
    Description
    static ScreenKind
    of(@Nullable net.minecraft.client.gui.screens.Screen screen)
    The look of screen.
    int
    The color of text in role in this look.
    boolean
    Whether text in this look has a drop shadow: the Default look's does (vanilla's menu text), the Panel look's does not (vanilla's container labels).
    static ScreenKind
    Returns the enum constant of this class with the specified name.
    static ScreenKind[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • PANEL

      public static final ScreenKind PANEL
      The Panel look: inventories, chests, anything built on AbstractContainerScreen. MenuKit's gray.
    • DEFAULT

      public static final ScreenKind DEFAULT
      The Default look: vanilla's Options, Controls, Create World and the like. The pause-menu look.
  • Field Details

    • OPTIONS

      @Deprecated(since="7.3.0", forRemoval=true) public static final ScreenKind OPTIONS
      Deprecated, for removal: This API element is subject to removal in a future version.
      Renamed DEFAULT in 7.3.0; removed in 8.0.0.
    • CONTAINER

      @Deprecated(since="7.3.0", forRemoval=true) public static final ScreenKind CONTAINER
      Deprecated, for removal: This API element is subject to removal in a future version.
      Renamed PANEL in 7.3.0; removed in 8.0.0.
  • Method Details

    • values

      public static ScreenKind[] 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

      public static ScreenKind valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • of

      public static ScreenKind of(@Nullable net.minecraft.client.gui.screens.Screen screen)
      The look of screen. Every host on a screen, and every screen MenuKit opens over another, uses this. A standalone MKScreen is the look it declared; any other AbstractContainerScreen is PANEL; any other screen is DEFAULT. No screen (the HUD, the game itself) is PANEL.
    • textColor

      public int textColor(TextRole role)
      The color of text in role in this look. Panel: dark gray (ElementConstants.TEXT_DARK) for headings and body, ElementConstants.TEXT_MUTED, ElementConstants.TEXT_DISABLED. An element's own text on a panel surface follows the surface's fill from these (AbstractPanelElement.textColor). Default: vanilla's own CommonColors, white for headings and body (the Options title, a setting's name), GRAY for secondary lines (the world list's details) and LIGHT_GRAY for disabled text (an inactive button's label).
    • textShadow

      public boolean textShadow()
      Whether text in this look has a drop shadow: the Default look's does (vanilla's menu text), the Panel look's does not (vanilla's container labels).