Class RenderNameTagEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.client.event.RenderNameTagEvent

public class RenderNameTagEvent extends EntityEvent
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:
  • Field Details

    • nameplateContent

      private Component nameplateContent
    • originalContent

      private final Component originalContent
    • entityRenderer

      private final EntityRenderer<?> entityRenderer
    • poseStack

      private final PoseStack poseStack
    • multiBufferSource

      private final MultiBufferSource multiBufferSource
    • packedLight

      private final int packedLight
    • partialTick

      private final float partialTick
  • Constructor Details

  • Method Details

    • setContent

      public void setContent(Component contents)
      Sets the new text on the nameplate.
      Parameters:
      contents - the new text
    • getContent

      public Component getContent()
      Returns the text on the nameplate that will be rendered, if the event is not DENIED.
      Returns:
      the text on the nameplate that will be rendered, if the event is not DENIED
    • getOriginalContent

      public Component getOriginalContent()
      Returns the original text on the nameplate.
      Returns:
      the original text on the nameplate
    • getEntityRenderer

      public EntityRenderer<?> getEntityRenderer()
      Returns the entity renderer rendering the nameplate.
      Returns:
      the entity renderer rendering the nameplate
    • getPoseStack

      public PoseStack getPoseStack()
      Returns the pose stack used for rendering.
      Returns:
      the pose stack used for rendering
    • getMultiBufferSource

      public MultiBufferSource 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