Skip to content

Commit

Permalink
Adjust hologram mount strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Oct 31, 2023
1 parent 401e34a commit 483b656
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main/src/main/java/net/citizensnpcs/trait/HologramTrait.java
Expand Up @@ -106,7 +106,6 @@ private NPC createHologram(String line, double heightOffset) {
hologramNPC = registry.createNPC(EntityType.INTERACTION, line);
hologramNPC.addTrait(new ClickRedirectTrait(npc));
hologramNPC.data().set(NPC.Metadata.NAMEPLATE_VISIBLE, true);
hologramNPC.getOrAddTrait(MountTrait.class).setMountedOn(npc.getUniqueId());
} else {
hologramNPC = registry.createNPC(EntityType.ARMOR_STAND, line);
hologramNPC.getOrAddTrait(ArmorStandTrait.class).setAsHelperEntityWithName(npc);
Expand Down Expand Up @@ -339,6 +338,10 @@ public void run() {
if (updateName) {
nameLine.setText(npc.getRawName());
}

if (useDisplayEntities && nameLine.hologram.getEntity().getVehicle() == null) {
npc.getEntity().addPassenger(nameLine.hologram.getEntity());
}
}

for (int i = 0; i < lines.size(); i++) {
Expand All @@ -359,6 +362,10 @@ public void run() {
hologramNPC.teleport(tp, TeleportCause.PLUGIN);
}

if (useDisplayEntities && hologramNPC.getEntity().getVehicle() == null) {
npc.getEntity().addPassenger(hologramNPC.getEntity());
}

String text = line.text;
if (ITEM_MATCHER.matcher(text).matches()) {
hologramNPC.data().set(NPC.Metadata.NAMEPLATE_VISIBLE, false);
Expand Down

0 comments on commit 483b656

Please sign in to comment.