Class EntityRenderersEvent.AddLayers
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.EntityRenderersEvent
net.neoforged.neoforge.client.event.EntityRenderersEvent.AddLayers
- All Implemented Interfaces:
net.neoforged.fml.event.IModBusEvent
- Enclosing class:
EntityRenderersEvent
Fired for registering entity renderer layers at the appropriate time, after the entity and player renderers maps
have been created.
This event is not cancellable, and does not
.invalid reference
have a result
This event is fired on the mod-specific event bus, only on the logical client.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.client.event.EntityRenderersEvent
EntityRenderersEvent.AddLayers, EntityRenderersEvent.CreateSkullModels, EntityRenderersEvent.RegisterLayerDefinitions, EntityRenderersEvent.RegisterRenderers
-
Field Summary
Modifier and TypeFieldDescriptionprivate final EntityRendererProvider.Context
private final Map
<EntityType<?>, EntityRenderer<?>> private final Map
<PlayerSkin.Model, EntityRenderer<? extends Player>> -
Constructor Summary
ConstructorDescriptionAddLayers
(Map<EntityType<?>, EntityRenderer<?>> renderers, Map<PlayerSkin.Model, EntityRenderer<? extends Player>> playerRenderers, EntityRendererProvider.Context context) -
Method Summary
Modifier and TypeMethodDescriptionReturns the context for the entity renderer provider.Returns the set of entity models.Set
<EntityType<?>> Returns the set of entity types which have a renderer.<T extends Entity,
R extends EntityRenderer<T>>
RgetRenderer
(EntityType<? extends T> entityType) Returns an entity renderer for the given entity type.<R extends EntityRenderer<? extends Player>>
RgetSkin
(PlayerSkin.Model skinModel) Returns a player skin renderer for the given skin name.getSkins()
Returns the set of player skin names which have a renderer.
-
Field Details
-
renderers
-
skinMap
-
context
-
-
Constructor Details
-
AddLayers
@Internal public AddLayers(Map<EntityType<?>, EntityRenderer<?>> renderers, Map<PlayerSkin.Model, EntityRenderer<? extends Player>> playerRenderers, EntityRendererProvider.Context context)
-
-
Method Details
-
getSkins
Returns the set of player skin names which have a renderer.Minecraft provides two default skin names:
default
for the regular player model andslim
for the slim player model.- Returns:
- the set of player skin names which have a renderer
-
getSkin
Returns a player skin renderer for the given skin name.- Type Parameters:
R
- the type of the skin renderer, usuallyPlayerRenderer
- Parameters:
skinModel
- the skin model to get the renderer for- Returns:
- the skin renderer, or
null
if no renderer is registered for that skin name - See Also:
-
getEntityTypes
Returns the set of entity types which have a renderer.- Returns:
- the set of entity types which have a renderer
-
getRenderer
@Nullable public <T extends Entity,R extends EntityRenderer<T>> R getRenderer(EntityType<? extends T> entityType) Returns an entity renderer for the given entity type. Note that the returned renderer may not be aLivingEntityRenderer
.- Type Parameters:
T
- the type of entity the renderer is forR
- the type of the renderer- Parameters:
entityType
- the entity type to return a renderer for- Returns:
- the renderer, or
null
if no renderer is registered for that entity type
-
getEntityModels
Returns the set of entity models.- Returns:
- the set of entity models
-
getContext
Returns the context for the entity renderer provider.- Returns:
- the context for the entity renderer provider
-