Skip to content

UniRenderLayer

Minecraft-independent configuration for an overlay or HUD UI layer.

Overview

UniRenderLayer represents an isolated layer rendered either in the in-game HUD or over an active GUI screen. It binds a root Widget, an optional UIContext, custom post-processing shader chains (UiPostEffectChain), render policies, and lifecycle hooks.

Post-Processing Effects

Layers support post-processing filters via postEffect(...), applying Gaussian blur, CRT scanlines, bloom, or color grading directly to the rendered layer buffer before blitting to the framebuffer.

Cache Invalidation and Lifecycle

Layers implementing AutoCloseable can be removed from rendering via close(). When rendered with dirty-tracking, invalidateRenderCache() signals the runtime to redraw the layer content.

Configuring a HUD Layer with Bloom

Widget hudWidget = new CompassWidget();
UniRenderLayer layer = new UniRenderLayer(hudWidget)
    .renderPolicy(UiRenderPolicy.continuous())
    .postEffect("unigui:bloom");
UniHudRender.register(layer);

API

UniRenderLayer::attachRuntimeControl(RuntimeLayerControl)

attachRuntimeControl(RuntimeLayerControl)

Internal hook attaching a runtime control controller.

Parameter Type Description
control RuntimeLayerControl RuntimeLayerControl instance.

UniRenderLayer::clearPostEffect()

clearPostEffect()

Clears all post-processing effects on this layer.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::close()

close()

Closes this layer and detaches it from the runtime.

UniRenderLayer::closed()

closed()

Returns true if this render layer has been closed.

Returns boolean: True if closed..

UniRenderLayer::context()

context()

Returns the UI context bound to this layer.

Returns UIContext: UIContext or null..

UniRenderLayer::debugHotkeysEnabled()

debugHotkeysEnabled()

Returns true if debug layout hotkeys are enabled for this layer.

Returns boolean: True if debug hotkeys are active..

UniRenderLayer::debugHotkeysEnabled(boolean)

debugHotkeysEnabled(boolean)

Enables or disables debug layout hotkeys for this layer.

Parameter Type Description
value boolean True to enable debug hotkeys.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::defaultFont()

defaultFont()

Returns the layer default font face or null.

Returns FontFace: FontFace or null..

UniRenderLayer::defaultFont(FontFace)

defaultFont(FontFace)

Sets the layer default font face.

Parameter Type Description
font FontFace FontFace to use.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::hasCustomUiScale()

hasCustomUiScale()

Returns true if a custom UI scale factor is configured.

Returns boolean: True if uiScale is finite..

UniRenderLayer::invalidateRenderCache()

invalidateRenderCache()

Invalidates cached rendering in the attached runtime layer.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::postEffect()

postEffect()

Returns a copy of the post-processing effect chain.

Returns UiPostEffectChain: UiPostEffectChain copy..

UniRenderLayer::postEffect(String)

postEffect(String)

Sets a single post-effect by identifier.

Parameter Type Description
effectId String Identifier of registered post-effect.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::postEffect(UiPostEffectChain)

postEffect(UiPostEffectChain)

Sets the post-processing effect chain for this layer.

Parameter Type Description
chain UiPostEffectChain Post-effect chain to apply.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::renderPolicy()

renderPolicy()

Returns the rendering policy of this layer.

Returns UiRenderPolicy: Active UiRenderPolicy..

UniRenderLayer::renderPolicy(UiRenderPolicy)

renderPolicy(UiRenderPolicy)

Configures the rendering policy of this layer.

Parameter Type Description
policy UiRenderPolicy UiRenderPolicy to set.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::root()

root()

Returns the root widget of this layer.

Returns Widget: Root widget instance..

UniRenderLayer::scaleWithGameGui()

scaleWithGameGui()

Returns true if the layer scales automatically with the game's GUI scale.

Returns boolean: True if scaling with game GUI..

UniRenderLayer::scaleWithGameGui(boolean)

scaleWithGameGui(boolean)

Configures whether this layer scales automatically with the game's GUI scale.

Parameter Type Description
value boolean True to enable auto-scaling with game GUI.

Returns UniRenderLayer: This layer instance for chaining..

UniRenderLayer::uiScale()

uiScale()

Returns the custom UI scaling factor or NaN if not set.

Returns float: Scale multiplier..

UniRenderLayer::uiScale(float)

uiScale(float)

Enforces a custom UI scale multiplier for this layer.

Parameter Type Description
scale float Positive finite scale factor.

Returns UniRenderLayer: This layer instance for chaining..