diff --git a/build.gradle b/build.gradle index 828a2aa..b81c644 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group = "com.github.echolightmc" -version = "1.2-SNAPSHOT" +version = "1.3-SNAPSHOT" repositories { mavenCentral() diff --git a/src/main/java/com/github/echolightmc/msnametags/NameTag.java b/src/main/java/com/github/echolightmc/msnametags/NameTag.java index ca0b3f6..5c73ed5 100644 --- a/src/main/java/com/github/echolightmc/msnametags/NameTag.java +++ b/src/main/java/com/github/echolightmc/msnametags/NameTag.java @@ -22,6 +22,8 @@ public class NameTag extends Entity { NameTag(Entity owningEntity, boolean transparentBackground) { super(EntityType.TEXT_DISPLAY); this.owningEntity = owningEntity; + hasPhysics = false; + hasCollision = false; textMeta = getEntityMeta(); textMeta.setNotifyAboutChanges(false); textMeta.setBillboardRenderConstraints(AbstractDisplayMeta.BillboardConstraints.VERTICAL); @@ -93,7 +95,8 @@ public void tick(long time) { // don't do anything in super tick as it's unneces @SuppressWarnings("UnstableApiUsage") @Override public void updateNewViewer(@NotNull Player player) { - player.sendPacket(NameTagManager.getPassengersPacket(owningEntity)); + super.updateNewViewer(player); + player.sendPacket(NameTagManager.getPassengersPacket(owningEntity)); // necessary otherwise it's not a passenger visually } /** @@ -102,8 +105,10 @@ public void updateNewViewer(@NotNull Player player) { * {@link net.minestom.server.instance.Instance} as the owning player. */ public void mount() { - setInstance(owningEntity.getInstance(), owningEntity.getPosition().asVec()); - owningEntity.addPassenger(this); + setInstance(owningEntity.getInstance(), owningEntity.getPosition()).whenComplete((unused, throwable) -> { + if (throwable != null) throwable.printStackTrace(); + else owningEntity.addPassenger(this); + }); } } diff --git a/src/main/java/com/github/echolightmc/msnametags/NameTagManager.java b/src/main/java/com/github/echolightmc/msnametags/NameTagManager.java index 4027d75..5e9e54e 100644 --- a/src/main/java/com/github/echolightmc/msnametags/NameTagManager.java +++ b/src/main/java/com/github/echolightmc/msnametags/NameTagManager.java @@ -10,7 +10,6 @@ import net.minestom.server.event.entity.EntityDespawnEvent; import net.minestom.server.event.entity.EntitySpawnEvent; import net.minestom.server.event.player.PlayerRespawnEvent; -import net.minestom.server.event.trait.EntityEvent; import net.minestom.server.instance.Instance; import net.minestom.server.network.packet.server.play.SetPassengersPacket; import net.minestom.server.network.packet.server.play.TeamsPacket;