Package net.minecraftforge.client.event
Class RenderNameTagEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.client.event.RenderNameTagEvent
Fired before an entity renderer renders the nameplate of an entity.
This event is not cancellable, and has a result.
Event.Result.ALLOW
- the nameplate will be forcibly rendered.Event.Result.DEFAULT
- the vanilla logic will be used.Event.Result.DENY
- the nameplate will not be rendered.
This event is fired on the main Forge event bus, only on the logical client.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.event.entity.EntityEvent
EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.EyeHeight, EntityEvent.Size
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EntityRenderer<?>
private final MultiBufferSource
private Component
private final Component
private final int
private final float
private final PoseStack
-
Constructor Summary
ConstructorsConstructorDescriptionRenderNameTagEvent
(Entity entity, Component content, EntityRenderer<?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick) -
Method Summary
Modifier and TypeMethodDescriptionReturns the text on the nameplate that will be rendered, if the event is notDENIED
.Returns the entity renderer rendering the nameplate.Returns the source of rendering buffers.Returns the original text on the nameplate.int
Returns the amount of packed (sky and block) light for rendering.float
Returns the partial tick.Returns the pose stack used for rendering.void
setContent
(Component contents) Sets the new text on the nameplate.Methods inherited from class net.minecraftforge.event.entity.EntityEvent
getEntity
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
nameplateContent
-
originalContent
-
entityRenderer
-
poseStack
-
multiBufferSource
-
packedLight
private final int packedLight -
partialTick
private final float partialTick
-
-
Constructor Details
-
RenderNameTagEvent
@Internal public RenderNameTagEvent(Entity entity, Component content, EntityRenderer<?> entityRenderer, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, float partialTick)
-
-
Method Details
-
setContent
Sets the new text on the nameplate.- Parameters:
contents
- the new text
-
getContent
Returns the text on the nameplate that will be rendered, if the event is notDENIED
.- Returns:
- the text on the nameplate that will be rendered, if the event is not
DENIED
-
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
-