Class RegisterGuiLayersEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.RegisterGuiLayersEvent
- All Implemented Interfaces:
IModBusEvent
Allows users to register custom
layers
for GUI rendering.
See also RenderGuiLayerEvent
to intercept rendering of registered layers.
This event is not cancellable.
This event is fired on the mod-specific event bus, only on the logical client.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
register
(RegisterGuiLayersEvent.Ordering ordering, @Nullable ResourceLocation other, ResourceLocation key, GuiLayer layer) void
registerAbove
(ResourceLocation other, ResourceLocation id, GuiLayer layer) Registers an layer that renders above another.void
registerAboveAll
(ResourceLocation id, GuiLayer layer) Registers a layer that renders above all others.void
registerBelow
(ResourceLocation other, ResourceLocation id, GuiLayer layer) Registers a layer that renders below another.void
registerBelowAll
(ResourceLocation id, GuiLayer layer) Registers a layer that renders below all others.void
replaceLayer
(ResourceLocation id, GuiLayer replacement) Replace the layer with the givenid
with a new one.void
wrapLayer
(ResourceLocation id, UnaryOperator<GuiLayer> wrapper) Wrap the layer with the givenid
in a new layer.
-
Field Details
-
layers
-
-
Constructor Details
-
RegisterGuiLayersEvent
-
-
Method Details
-
registerBelowAll
Registers a layer that renders below all others.- Parameters:
id
- A unique resource id for this layerlayer
- The layer
-
registerBelow
Registers a layer that renders below another.- Parameters:
other
- The id of the layer to render below. This must be a layer you have already registered or one of thevanilla layers
. Do not use other mods' layers.id
- A unique resource id for this layerlayer
- The layer
-
registerAbove
Registers an layer that renders above another.- Parameters:
other
- The id of the layer to render above. This must be a layer you have already registered or one of thevanilla layers
. Do not use other mods' layers.id
- A unique resource id for this layerlayer
- The layer
-
registerAboveAll
Registers a layer that renders above all others.- Parameters:
id
- A unique resource id for this layerlayer
- The layer
-
replaceLayer
Replace the layer with the givenid
with a new one.- Parameters:
id
- the id of the layer to replacereplacement
- the layer to replace it with- Throws:
IllegalArgumentException
- if a layer with the givenid
is not yet registered- See Also:
-
wrapLayer
Wrap the layer with the givenid
in a new layer.This can be used, for instance, to apply pose stack transformations to move the layer or resize it.
- Parameters:
id
- the id of the layer to wrapwrapper
- an unary operator which takes in the old layer and returns the new layer that wraps the old one- Throws:
IllegalArgumentException
- if a layer with the givenid
is not yet registered
-
register
private void register(RegisterGuiLayersEvent.Ordering ordering, @Nullable @Nullable ResourceLocation other, ResourceLocation key, GuiLayer layer)
-