Skip to content

[1.21.5] Allow replacing / wrapping existing layers in RegisterGuiLayersEvent #2214

Description

@Fuzss

Currently RegisterGuiLayersEvent only allows for adding new gui layers.
Would be great if existing layers could be replaced / wrapped.

My use case is e.g. wrapping a layer with a PoseStack::pushPose/popPose call for applying a translation.

Right now this can be done via RenderGuiLayerEvent.Pre, but that requires manually rendering the layer and subsequently cancelling the event to prevent default rendering. The issue with that is it doesn't stack when done by multiple mods.

Fabric also supports this in their new GuiLayer api: https://github.com/FabricMC/fabric/blob/f3a2fccadc3ada58e505adf75a62658a74a6b0c4/fabric-rendering-v1/src/client/java/net/fabricmc/fabric/api/client/rendering/v1/LayeredDrawerWrapper.java#L152
(although I'd recommend against being able to provide a new identifier for the replacement layer as Fabric does, as it will break mods expecting a layer under the original identifier to be present)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: renderingRelated to renderingenhancementNew (or improvement to existing) feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions