Skip to content

Commit

Permalink
Fix missing super
Browse files Browse the repository at this point in the history
  • Loading branch information
hapily04 committed Jun 29, 2024
1 parent d908c3f commit dd2bcb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "com.github.echolightmc"
version = "1.2-SNAPSHOT"
version = "1.3-SNAPSHOT"

repositories {
mavenCentral()
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/com/github/echolightmc/msnametags/NameTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
}

/**
Expand All @@ -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);
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dd2bcb0

Please sign in to comment.