Package net.citizensnpcs.trait
Class HologramTrait.SingleEntityHologramRenderer
java.lang.Object
net.citizensnpcs.trait.HologramTrait.SingleEntityHologramRenderer
- All Implemented Interfaces:
HologramTrait.HologramRenderer
- Direct Known Subclasses:
HologramTrait.AreaEffectCloudRenderer
,HologramTrait.ArmorstandRenderer
,HologramTrait.ArmorstandVehicleRenderer
,HologramTrait.InteractionVehicleRenderer
,HologramTrait.ItemDisplayRenderer
,HologramTrait.ItemRenderer
,HologramTrait.TextDisplayRenderer
- Enclosing class:
HologramTrait
public abstract static class HologramTrait.SingleEntityHologramRenderer
extends Object
implements HologramTrait.HologramRenderer
A helper class that models a hologram as a single entity that represents a single line in game.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract NPC
void
destroy()
Destroy/teardown any rendered holograms.getPerPlayerText
(NPC npc, Player viewer) Ifinvalid reference
NPC.Metadata.HOLOGRAM_RENDERER
protected NPCRegistry
registry()
void
Render the hologram at a given offset.protected abstract void
Hologram spawning is delegated tocreateNPC(Entity, String, Vector3d)
void
setRegistry
(NPCRegistry registry) void
setViewRange
(int range) protected void
spawnHologram
(NPC npc, org.joml.Vector3d offset) void
updateText
(NPC npc, String raw) Update the hologram text.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.citizensnpcs.trait.HologramTrait.HologramRenderer
isSneaking, onSeenByPlayer, setBackgroundColor, setTextShadow
-
Field Details
-
hologram
-
text
-
-
Constructor Details
-
SingleEntityHologramRenderer
public SingleEntityHologramRenderer()
-
-
Method Details
-
createNPC
-
destroy
public void destroy()Description copied from interface:HologramTrait.HologramRenderer
Destroy/teardown any rendered holograms.- Specified by:
destroy
in interfaceHologramTrait.HologramRenderer
-
getEntities
- Specified by:
getEntities
in interfaceHologramTrait.HologramRenderer
- Returns:
- Any associated hologram entities. Used in
HologramTrait.HologramRenderer.getEntities()
.
-
getPerPlayerText
Description copied from interface:HologramTrait.HologramRenderer
Ifinvalid reference
NPC.Metadata.HOLOGRAM_RENDERER
- Specified by:
getPerPlayerText
in interfaceHologramTrait.HologramRenderer
- Parameters:
npc
- the hologram NPCviewer
- the viewing Player- Returns:
- the modified text per Player
-
registry
-
render
Description copied from interface:HologramTrait.HologramRenderer
Render the hologram at a given offset. Any underlying hologram NPCs should be spawned at this point.- Specified by:
render
in interfaceHologramTrait.HologramRenderer
- Parameters:
npc
- the parent NPC.offset
- the offset, in blocks
-
render0
Hologram spawning is delegated tocreateNPC(Entity, String, Vector3d)
-
setRegistry
-
setViewRange
public void setViewRange(int range) -
spawnHologram
-
updateText
Description copied from interface:HologramTrait.HologramRenderer
Update the hologram text. Will be called first beforeHologramTrait.HologramRenderer.render(NPC, Vector3d)
.- Specified by:
updateText
in interfaceHologramTrait.HologramRenderer
- Parameters:
npc
- the parent NPCraw
- the new hologram text
-