Interface LayeredDrawerWrapper


public interface LayeredDrawerWrapper
A layered drawer that has an identifier attached to each layer and methods to add layers in specific positions.

Operations relative to a layer will generally inherit that layer's render condition. The render condition for all vanilla layers except IdentifiedLayer.SLEEP is GameOptions.hudHidden. Only addLayer(IdentifiedLayer) will not inherit any render condition. There is currently no mechanism to change the render condition of a layer. For vanilla layers, see IdentifiedLayer.

Common places to add layers (as of 1.21.4):

Injection Point Use Case
Before MISC_OVERLAYS Render before everything
After MISC_OVERLAYS Render after misc overlays (vignette, spyglass, and powder snow) and before the crosshair
After EXPERIENCE_LEVEL Render after most main hud elements like hotbar, spectator hud, status bars, experience bar, status effects overlays, and boss bar and before the sleep overlay
Before DEMO_TIMER Render after sleep overlay and before the demo timer, debug HUD, scoreboard, overlay message (action bar), and title and subtitle
Before CHAT Render after the debug HUD, scoreboard, overlay message (action bar), and title and subtitle and before ChatHud, player list, and sound subtitles
After SUBTITLES Render after everything
See Also:
  • Method Details

    • addLayer

      @Contract("_ -> this") LayeredDrawerWrapper addLayer(IdentifiedLayer layer)
      Adds a layer to the end of the layered drawer.
      Parameters:
      layer - the layer to add
      Returns:
      this layered drawer
    • attachLayerBefore

      @Contract("_, _ -> this") LayeredDrawerWrapper attachLayerBefore(Identifier beforeThis, IdentifiedLayer layer)
      Attaches a layer before the layer with the specified identifier.

      The render condition of the layer being attached to, if any, also applies to the new layer.

      Parameters:
      beforeThis - the identifier of the layer to add the new layer before
      layer - the layer to add
      Returns:
      this layered drawer
    • attachLayerBefore

      @Contract("_, _, _ -> this") default LayeredDrawerWrapper attachLayerBefore(Identifier beforeThis, Identifier identifier, LayeredDrawer.Layer layer)
      Attaches a layer before the layer with the specified identifier.

      The render condition of the layer being attached to, if any, also applies to the new layer.

      Parameters:
      beforeThis - the identifier of the layer to add the new layer before
      identifier - the identifier of the new layer
      layer - the layer to add
      Returns:
      this layered drawer
    • attachLayerAfter

      @Contract("_, _ -> this") LayeredDrawerWrapper attachLayerAfter(Identifier afterThis, IdentifiedLayer layer)
      Attaches a layer after the layer with the specified identifier.

      The render condition of the layer being attached to, if any, also applies to the new layer.

      Parameters:
      afterThis - the identifier of the layer to add the new layer after
      layer - the layer to add
      Returns:
      this layered drawer
    • attachLayerAfter

      @Contract("_, _, _ -> this") default LayeredDrawerWrapper attachLayerAfter(Identifier afterThis, Identifier identifier, LayeredDrawer.Layer layer)
      Attaches a layer after the layer with the specified identifier.

      The render condition of the layer being attached to, if any, also applies to the new layer.

      Parameters:
      afterThis - the identifier of the layer to add the new layer after
      identifier - the identifier of the new layer
      layer - the layer to add
      Returns:
      this layered drawer
    • removeLayer

      @Contract("_ -> this") LayeredDrawerWrapper removeLayer(Identifier identifier)
      Removes a layer with the specified identifier.
      Parameters:
      identifier - the identifier of the layer to remove
      Returns:
      this layered drawer
    • replaceLayer

      @Contract("_, _ -> this") LayeredDrawerWrapper replaceLayer(Identifier identifier, Function<IdentifiedLayer,IdentifiedLayer> replacer)
      Replaces a layer with the specified identifier.

      The render condition of the layer being replaced, if any, also applies to the new layer.

      Parameters:
      identifier - the identifier of the layer to replace
      replacer - a function that takes the old layer and returns the new layer
      Returns:
      this layered drawer