Package net.citizensnpcs.trait
Class HologramTrait
java.lang.Object
net.citizensnpcs.api.trait.Trait
net.citizensnpcs.trait.HologramTrait
Persists a hologram attached to the NPC.
-
Nested Class Summary
Nested Classes -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new hologram line which will displayed over an NPC's head.voidclear()Clears all hologram linesNote: this is implementation-specific and may be removed at a later date.doublegetLines()Note: this is implementation-specific and may be removed at a later date.voidCalled just before the attachedNPCis despawned.voidonRemove()Called when a trait is removed from the attachedNPC.voidonSpawn()Called when anNPCis spawned.voidremoveLine(int idx) Removes the line at the specified indexvoidrun()Called every tick if overridden.voidsetDirection(HologramTrait.HologramDirection direction) voidSets the hologram line at a specific indexvoidsetLineHeight(double height) Sets the line heightMethods inherited from class net.citizensnpcs.api.trait.Trait
getName, getNPC, isRunImplemented, linkToNPC, load, onAttach, onCopy, onPreSpawn, save
-
Constructor Details
-
HologramTrait
public HologramTrait()
-
-
Method Details
-
addLine
Adds a new hologram line which will displayed over an NPC's head.- Parameters:
text- The new line to add
-
clear
public void clear()Clears all hologram lines -
getDirection
- Returns:
- The direction that hologram lines are displayed in
-
getHologramEntities
Note: this is implementation-specific and may be removed at a later date. -
getLineHeight
public double getLineHeight()- Returns:
- The line height between each hologram line, in blocks
-
getLines
- Returns:
- the hologram lines, in bottom-up order
-
getNameEntity
Note: this is implementation-specific and may be removed at a later date. -
onDespawn
public void onDespawn()Description copied from class:TraitCalled just before the attachedNPCis despawned.NPC.getEntity()will be non-null. -
onRemove
public void onRemove()Description copied from class:TraitCalled when a trait is removed from the attachedNPC. -
onSpawn
public void onSpawn()Description copied from class:TraitCalled when anNPCis spawned.NPC.getEntity()will return null until this is called. This is also called onAttach when the NPC is already spawned. -
removeLine
public void removeLine(int idx) Removes the line at the specified index- Parameters:
idx-
-
run
public void run()Description copied from class:TraitCalled every tick if overridden. -
setDirection
- Parameters:
direction- The new direction- See Also:
-
setLine
Sets the hologram line at a specific index- Parameters:
idx- The indextext- The new line
-
setLineHeight
public void setLineHeight(double height) Sets the line height- Parameters:
height- The line height in blocks- See Also:
-