@@ -22,6 +22,7 @@ final class ModernHologram implements Hologram.Modern {
2222 private final List <WrapperEntity > lines = new ArrayList <>(3 );
2323 private Consumer <TextDisplayMeta > modifier ;
2424 private boolean spawned = false ;
25+ private WrapperEntity parent ;
2526
2627 ModernHologram (@ NotNull Location location ) {
2728 this .location = location ;
@@ -55,6 +56,11 @@ public void hide() {
5556 public void teleport (Location location ) {
5657 this .location = location ;
5758 if (lines .isEmpty ()) return ;
59+
60+ if (parent != null ) {
61+ return ;
62+ }
63+
5864 WrapperEntity first = lines .get (0 );
5965 first .teleport (location );
6066 for (WrapperEntity e : lines ) {
@@ -63,6 +69,23 @@ public void teleport(Location location) {
6369 }
6470 }
6571
72+ @ Override
73+ public void setParent (@ NotNull WrapperEntity parent ) {
74+ this .parent = parent ;
75+ if (lines .isEmpty ()) return ;
76+
77+ WrapperEntity first = lines .get (0 );
78+ for (WrapperEntity e : lines ) {
79+ if (e .getUuid ().equals (first .getUuid ())) continue ;
80+ try {
81+ first .addPassenger (e );
82+ } catch (Exception ignored ) {}
83+ }
84+ try {
85+ parent .addPassenger (first );
86+ } catch (Exception ignored ) {}
87+ }
88+
6689 @ Override
6790 public @ Nullable Component getLine (int index ) {
6891 if (index < 0 || index >= lines .size ()) {
@@ -79,6 +102,7 @@ public void setLine(int index, @Nullable Component line) {
79102 meta .setInvisible (true );
80103 meta .setHasNoGravity (true );
81104 meta .setText (line );
105+ meta .setBillboardConstraints (me .tofaa .entitylib .meta .display .AbstractDisplayMeta .BillboardConstraints .CENTER );
82106 if (this .modifier != null ) {
83107 this .modifier .accept (meta );
84108 }
@@ -110,6 +134,13 @@ public void addViewer(@NotNull UUID viewer) {
110134 }
111135 }
112136
137+ @ Override
138+ public void removeViewer (@ NotNull UUID viewer ) {
139+ for (WrapperEntity line : lines ) {
140+ line .removeViewer (viewer );
141+ }
142+ }
143+
113144
114145 @ Override
115146 public int length () {
@@ -121,6 +152,11 @@ public int length() {
121152 return location ;
122153 }
123154
155+ @ Override
156+ public @ NotNull WrapperEntity getEntity () {
157+ return lines .isEmpty () ? null : lines .get (0 );
158+ }
159+
124160
125161 @ Override
126162 public void setModifier (@ NotNull Consumer <TextDisplayMeta > consumer ) {
0 commit comments