Class RenderNameTagEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.client.event.RenderNameTagEvent
This event is fired before an entity renderer renders the nameplate of an entity.
It allows reacting to the render and controlling if the name plate will be rendered, as well as changing the rendered name.
This event is only fired on the logical client.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TriStateprivate Componentprivate final EntityRenderer<?> private final MultiBufferSourceprivate final Componentprivate final intprivate final floatprivate final PoseStack -
Constructor Summary
ConstructorsConstructorDescriptionRenderNameTagEvent(Entity entity, Component content, EntityRenderer<?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick) -
Method Summary
Modifier and TypeMethodDescriptionReturns if the nameplate will render or not.Returns the text on the nameplate that will be rendered.Returns the entity renderer rendering the nameplate.Returns the source of rendering buffers.Returns the original text on the nameplate.intReturns the amount of packed (sky and block) light for rendering.floatReturns the partial tick.Returns the pose stack used for rendering.voidsetCanRender(TriState canRender) Changes if thecontentof the nameplate will be rendered.voidsetContent(Component contents) Sets the new text on the nameplate.Methods inherited from class net.neoforged.neoforge.event.entity.EntityEvent
getEntity
-
Field Details
-
originalContent
-
entityRenderer
-
poseStack
-
multiBufferSource
-
packedLight
private final int packedLight -
partialTick
private final float partialTick -
-
canRender
-
-
Constructor Details
-
RenderNameTagEvent
@Internal public RenderNameTagEvent(Entity entity, Component content, EntityRenderer<?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick)
-
-
Method Details
-
setCanRender
Changes if thecontentof the nameplate will be rendered.TriState.TRUEandTriState.FALSEwill allow/deny the render respectively.Using
TriState.DEFAULTwill cause the name to render ifEntityRenderer.shouldShowName(T)returns true. -
canRender
Returns if the nameplate will render or not.- Returns:
- if the nameplate will render or not
-
setContent
Sets the new text on the nameplate.- Parameters:
contents- the new text
-
getContent
Returns the text on the nameplate that will be rendered.- Returns:
- the text on the nameplate that will be rendered
-
getOriginalContent
Returns the original text on the nameplate.- Returns:
- the original text on the nameplate
-
getEntityRenderer
Returns the entity renderer rendering the nameplate.- Returns:
- the entity renderer rendering the nameplate
-
getPoseStack
Returns the pose stack used for rendering.- Returns:
- the pose stack used for rendering
-
getMultiBufferSource
Returns the source of rendering buffers.- Returns:
- the source of rendering buffers
-
getPackedLight
public int getPackedLight()Returns the amount of packed (sky and block) light for rendering.- Returns:
- the amount of packed (sky and block) light for rendering
- See Also:
-
getPartialTick
public float getPartialTick()Returns the partial tick.- Returns:
- the partial tick
-