Fix de-spawn packet implementation to support 1.17.1
This commit is contained in:
parent
9dc510d758
commit
96261af9f8
@ -69,8 +69,17 @@ public final class EntityCreator {
|
||||
}
|
||||
|
||||
public static void sendEntityDespawnPacket(final Player target, final int entityID) {
|
||||
sendEntityDespawnPackets(target, entityID);
|
||||
}
|
||||
|
||||
public static void sendEntityDespawnPackets(final Player target, final int... entityIDs) {
|
||||
final Package versionPackage = getNativePacketPackage(target);
|
||||
Packets.sendPacket(target, reflectConstruct(loadClass(versionPackage, "PacketPlayOutEntityDestroy", "game.PacketPlayOutEntityDestroy"), entityID));
|
||||
try {
|
||||
Packets.sendPacket(target, reflectConstruct(loadClass(versionPackage, "PacketPlayOutEntityDestroy", "game.PacketPlayOutEntityDestroy"), new Object[]{ entityIDs }));
|
||||
} catch (Throwable t) {
|
||||
for (int entityID : entityIDs)
|
||||
Packets.sendPacket(target, reflectConstruct(loadClass(versionPackage, "PacketPlayOutEntityDestroy", "game.PacketPlayOutEntityDestroy"), entityID));
|
||||
}
|
||||
}
|
||||
|
||||
public static int getEntityID(final Object entity) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user