Interface HologramTrait.HologramRenderer

All Known Implementing Classes:
HologramTrait.ArmorstandRenderer, HologramTrait.ArmorstandVehicleRenderer, HologramTrait.InteractionVehicleRenderer, HologramTrait.ItemDisplayRenderer, HologramTrait.ItemRenderer, HologramTrait.SingleEntityHologramRenderer, HologramTrait.TextDisplayRenderer, HologramTrait.TextDisplayVehicleRenderer
Enclosing class:
HologramTrait

public static interface HologramTrait.HologramRenderer
API for rendering holograms. Assumptions are documented in Javadoc but the API is early and subject to change. Feedback is welcomed.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Destroy/teardown any rendered holograms.
     
    getPerPlayerText(NPC hologram, Player viewer)
    If is set on any entity and ProtocolLib is enabled, this method will be called to modify the name per-player.
    default boolean
    isSneaking(NPC hologram, Player player)
    If is set on any entity and ProtocolLib is enabled, returns whether the NPC should be considered sneaking or not to the viewing player.
    default void
    onSeenByPlayer(NPC hologram, Player player)
    If is set on any entity, called when it is seen for the first time by a Player.
    void
    render(NPC parent, org.joml.Vector3d offset)
    Render the hologram at a given offset.
    void
    updateText(NPC parent, String text)
    Update the hologram text.
  • Method Details

    • destroy

      void destroy()
      Destroy/teardown any rendered holograms.
    • getEntities

      Collection<Entity> getEntities()
      Returns:
      Any associated hologram entities. Used in getEntities().
    • getPerPlayerText

      String getPerPlayerText(NPC hologram, Player viewer)
      If is set on any entity and ProtocolLib is enabled, this method will be called to modify the name per-player. Note: this should be async-safe. This method is fragile and may be moved elsewhere.
      Parameters:
      hologram - the hologram NPC
      viewer - the viewing Player
      Returns:
      the modified text per Player
    • isSneaking

      default boolean isSneaking(NPC hologram, Player player)
      If is set on any entity and ProtocolLib is enabled, returns whether the NPC should be considered sneaking or not to the viewing player. Presently called only when player first sees the NPC (i.e. not proactively).Note: this should be async-safe. This method is fragile and may be moved elsewhere.
      Parameters:
      hologram - the hologram NPC
      player - the viewing Player
      Returns:
      whether the NPC is sneaking
    • onSeenByPlayer

      default void onSeenByPlayer(NPC hologram, Player player)
      If is set on any entity, called when it is seen for the first time by a Player.
      Parameters:
      hologram - the hologram NPC
      player - the viewing Player
    • render

      void render(NPC parent, org.joml.Vector3d offset)
      Render the hologram at a given offset. Any underlying hologram NPCs should be spawned at this point.
      Parameters:
      parent - the parent NPC.
      offset - the offset, in blocks
    • updateText

      void updateText(NPC parent, String text)
      Update the hologram text. Will be called first before render(NPC, Vector3d).
      Parameters:
      parent - the parent NPC
      text - the new hologram text