mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-26 11:07:59 +01:00
Fix bug and add a method to simplify name showing
This commit is contained in:
parent
da76924041
commit
f4e3786514
@ -135,6 +135,11 @@ public class ArmorStandTrait extends Trait {
|
|||||||
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAsPointEntityWithName() {
|
||||||
|
setAsPointEntity();
|
||||||
|
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ArmorStand#setGravity(boolean)
|
* @see ArmorStand#setGravity(boolean)
|
||||||
*/
|
*/
|
||||||
|
@ -73,8 +73,7 @@ public class HologramTrait extends Trait {
|
|||||||
private NPC createHologram(String line, double heightOffset) {
|
private NPC createHologram(String line, double heightOffset) {
|
||||||
NPC hologramNPC = registry.createNPC(EntityType.ARMOR_STAND, line);
|
NPC hologramNPC = registry.createNPC(EntityType.ARMOR_STAND, line);
|
||||||
hologramNPC.addTrait(new ClickRedirectTrait(npc));
|
hologramNPC.addTrait(new ClickRedirectTrait(npc));
|
||||||
hologramNPC.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
|
hologramNPC.getOrAddTrait(ArmorStandTrait.class).setAsPointEntityWithName();
|
||||||
npc.data().set(NPC.NAMEPLATE_VISIBLE_METADATA, true);
|
|
||||||
hologramNPC.spawn(currentLoc.clone().add(0,
|
hologramNPC.spawn(currentLoc.clone().add(0,
|
||||||
getEntityHeight()
|
getEntityHeight()
|
||||||
+ (direction == HologramDirection.BOTTOM_UP ? heightOffset : getMaxHeight() - heightOffset),
|
+ (direction == HologramDirection.BOTTOM_UP ? heightOffset : getMaxHeight() - heightOffset),
|
||||||
|
Loading…
Reference in New Issue
Block a user