Package net.citizensnpcs.trait
Interface HologramTrait.HologramRenderer
- All Known Implementing Classes:
HologramTrait.AreaEffectCloudRenderer
,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 TypeMethodDescriptionvoid
destroy()
Destroy/teardown any rendered holograms.Gets hologram entities associated with the Hologram Trait.getPerPlayerText
(NPC hologram, Player viewer) IfNPC.Metadata.HOLOGRAM_RENDERER
is set on any entity and ProtocolLib is enabled, this method will be called to modify the name per-player.default boolean
isSneaking
(NPC npc, Player player) IfNPC.Metadata.HOLOGRAM_RENDERER
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) IfNPC.Metadata.HOLOGRAM_RENDERER
is set on any entity, called when it is seen for the first time by a Player.void
Render the hologram at a given offset.default void
setBackgroundColor
(Color color) default void
setTextShadow
(boolean shadow) void
updateText
(NPC parent, String text) Update the hologram text.
-
Method Details
-
destroy
void destroy()Destroy/teardown any rendered holograms. -
getEntities
Collection<Entity> getEntities()Gets hologram entities associated with the Hologram Trait.- Returns:
- Any associated hologram entities.
-
getPerPlayerText
IfNPC.Metadata.HOLOGRAM_RENDERER
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 NPCviewer
- the viewing Player- Returns:
- the modified text per Player
-
isSneaking
IfNPC.Metadata.HOLOGRAM_RENDERER
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:
npc
- the NPCplayer
- the viewing Player- Returns:
- whether the NPC is sneaking
-
onSeenByPlayer
IfNPC.Metadata.HOLOGRAM_RENDERER
is set on any entity, called when it is seen for the first time by a Player.- Parameters:
hologram
- the hologram NPCplayer
- the viewing Player
-
render
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
-
setBackgroundColor
-
setTextShadow
default void setTextShadow(boolean shadow) -
updateText
Update the hologram text. Will be called first beforerender(NPC, Vector3d)
.- Parameters:
parent
- the parent NPCtext
- the new hologram text
-