Interface LayeredDrawerWrapper
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 Summary
Modifier and TypeMethodDescriptionaddLayer(IdentifiedLayer layer) Adds a layer to the end of the layered drawer.attachLayerAfter(Identifier afterThis, IdentifiedLayer layer) Attaches a layer after the layer with the specified identifier.default LayeredDrawerWrapperattachLayerAfter(Identifier afterThis, Identifier identifier, LayeredDrawer.Layer layer) Attaches a layer after the layer with the specified identifier.attachLayerBefore(Identifier beforeThis, IdentifiedLayer layer) Attaches a layer before the layer with the specified identifier.default LayeredDrawerWrapperattachLayerBefore(Identifier beforeThis, Identifier identifier, LayeredDrawer.Layer layer) Attaches a layer before the layer with the specified identifier.removeLayer(Identifier identifier) Removes a layer with the specified identifier.replaceLayer(Identifier identifier, Function<IdentifiedLayer, IdentifiedLayer> replacer) Replaces a layer with the specified identifier.
-
Method Details
-
addLayer
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 beforelayer- 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 beforeidentifier- the identifier of the new layerlayer- 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 afterlayer- 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 afteridentifier- the identifier of the new layerlayer- the layer to add- Returns:
- this layered drawer
-
removeLayer
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 replacereplacer- a function that takes the old layer and returns the new layer- Returns:
- this layered drawer
-