From e4a1b93c6801628bb7ecb75d6b4013d8dbf755ca Mon Sep 17 00:00:00 2001 From: 3add <3add.development@gmail.com> Date: Tue, 12 May 2026 16:38:51 +0200 Subject: [PATCH 1/3] Add getEntityId method to EntityMeta --- api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java b/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java index bc8fe51..2f48a36 100644 --- a/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java +++ b/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java @@ -288,4 +288,8 @@ public void setMaskBit(int index, byte bit, boolean value) { public Metadata getMetadata() { return metadata; } + + public int getEntityId() { + return entityId; + } } From be460de94bb40815aaa34d2a53281f1bd5521d8d Mon Sep 17 00:00:00 2001 From: 3add <3add.development@gmail.com> Date: Tue, 12 May 2026 16:53:56 +0200 Subject: [PATCH 2/3] Fix packet order: sending tablist info before spawning entity as according to mc protocol. --- .../me/tofaa/entitylib/wrapper/WrapperPlayer.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperPlayer.java b/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperPlayer.java index d50a91b..ec7f413 100644 --- a/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperPlayer.java +++ b/api/src/main/java/me/tofaa/entitylib/wrapper/WrapperPlayer.java @@ -5,6 +5,7 @@ import com.github.retrooper.packetevents.protocol.player.GameMode; import com.github.retrooper.packetevents.protocol.player.TextureProperty; import com.github.retrooper.packetevents.protocol.player.UserProfile; +import com.github.retrooper.packetevents.protocol.world.Location; import com.github.retrooper.packetevents.wrapper.PacketWrapper; import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities; import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityHeadLook; @@ -13,6 +14,7 @@ import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate; import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer; import me.tofaa.entitylib.EntityLib; +import me.tofaa.entitylib.container.EntityContainer; import me.tofaa.entitylib.meta.EntityMeta; import java.util.EnumSet; import java.util.List; @@ -54,6 +56,15 @@ protected PacketWrapper createSpawnPacket() { return packets; } + @Override + public boolean spawn(Location location, EntityContainer parent) { + if (isSpawned()) return false; + + sendPacketToViewers(tabListPacket()); + + return super.spawn(location, parent); + } + public WrapperPlayServerPlayerInfoUpdate tabListPacket() { EnumSet actions = EnumSet.of( WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER, From 4ae42f99daa6a52e20d4f3639522262efcdfcc46 Mon Sep 17 00:00:00 2001 From: 3add <3add.development@gmail.com> Date: Tue, 12 May 2026 16:56:12 +0200 Subject: [PATCH 3/3] Revert "Add getEntityId method to EntityMeta" This reverts commit e4a1b93c6801628bb7ecb75d6b4013d8dbf755ca. --- api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java b/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java index 2f48a36..bc8fe51 100644 --- a/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java +++ b/api/src/main/java/me/tofaa/entitylib/meta/EntityMeta.java @@ -288,8 +288,4 @@ public void setMaskBit(int index, byte bit, boolean value) { public Metadata getMetadata() { return metadata; } - - public int getEntityId() { - return entityId; - } }