Skip to content

Commit

Permalink
Fix bug and add a method to simplify name showing
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Apr 17, 2022
1 parent da76924 commit f4e3786
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ public void setAsPointEntity() {
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
}

public void setAsPointEntityWithName() {
setAsPointEntity();
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, true);
}

/**
* @see ArmorStand#setGravity(boolean)
*/
Expand Down
3 changes: 1 addition & 2 deletions main/src/main/java/net/citizensnpcs/trait/HologramTrait.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ public void clear() {
private NPC createHologram(String line, double heightOffset) {
NPC hologramNPC = registry.createNPC(EntityType.ARMOR_STAND, line);
hologramNPC.addTrait(new ClickRedirectTrait(npc));
hologramNPC.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, true);
hologramNPC.getOrAddTrait(ArmorStandTrait.class).setAsPointEntityWithName();
hologramNPC.spawn(currentLoc.clone().add(0,
getEntityHeight()
+ (direction == HologramDirection.BOTTOM_UP ? heightOffset : getMaxHeight() - heightOffset),
Expand Down

0 comments on commit f4e3786

Please sign in to comment.