Check hologram height on spawn properly

This commit is contained in:
fullwall 2021-09-21 17:24:13 +08:00
parent 49559e26bc
commit 620cda6542

View File

@ -95,7 +95,8 @@ public class HologramTrait extends Trait {
} }
private double getHeight(int lineNumber) { private double getHeight(int lineNumber) {
return (lineHeight == -1 ? Setting.DEFAULT_NPC_HOLOGRAM_LINE_HEIGHT.asDouble() : lineHeight) * (lineNumber + 1); return (lineHeight == -1 ? Setting.DEFAULT_NPC_HOLOGRAM_LINE_HEIGHT.asDouble() : lineHeight)
* (lastNameplateVisible ? lineNumber + 1 : lineNumber);
} }
/** /**
@ -212,8 +213,7 @@ public class HologramTrait extends Trait {
if (!hologramNPC.isSpawned()) if (!hologramNPC.isSpawned())
continue; continue;
if (update) { if (update) {
hologramNPC.teleport( hologramNPC.teleport(currentLoc.clone().add(0, getEntityHeight() + getHeight(i), 0),
currentLoc.clone().add(0, getEntityHeight() + getHeight(nameplateVisible ? i : i - 1), 0),
TeleportCause.PLUGIN); TeleportCause.PLUGIN);
} }
if (i >= lines.size()) { if (i >= lines.size()) {