Skip to content

Commit 1dce582

Browse files
committed
Attempt fix legacy hologram desync
1 parent 0a3dc10 commit 1dce582

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

api/src/main/java/me/tofaa/entitylib/wrapper/hologram/LegacyHologram.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ public void hide() {
141141
@Override
142142
public void teleport(Location location) {
143143
this.location = location;
144-
// reversed order
145144
for (int i = lines.size() - 1; i >= 0; i--) {
146145
WrapperEntity line = lines.get(i);
146+
if (!line.isSpawned()) {
147+
line.spawn(location);
148+
spawned = true;
149+
}
147150
double y;
148151
if (marker) {
149152
y = location.getY() + markerOffset;
@@ -155,6 +158,9 @@ public void teleport(Location location) {
155158
Location l = new Location(location.getX(), y, location.getZ(), location.getYaw(), location.getPitch());
156159
line.teleport(l, false);
157160
}
161+
if (spawned) {
162+
setParent(getEntity());
163+
}
158164
}
159165

160166
@Override
@@ -225,9 +231,11 @@ public void setParent(@NotNull WrapperEntity parent) {
225231
first.addPassenger(e);
226232
} catch (Exception ignored) {}
227233
}
228-
try {
229-
parent.addPassenger(first);
230-
} catch (Exception ignored) {}
234+
if (!first.getUuid().equals(parent.getUuid())) {
235+
try {
236+
parent.addPassenger(first);
237+
} catch (Exception ignored) {}
238+
}
231239
}
232240

233241
}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
val fullVersion = "3.2.1"
1+
val fullVersion = "3.2.2"
22
val snapshot = true
33

44
group = "io.github.tofaa2"

0 commit comments

Comments
 (0)