Packet PacketPlayOutEntityDestroy define which entity ?

Discussion in 'Plugin Development' started by Frostyy, Jun 28, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    Frostyy

    Hey, I know this doenst affect the Bukkit - API but maybe you could help me with my problem. I´m using packets to spawn a entity on a certain Location. I know, Bukkit has a method for spawning entitys but it should be client sided so I´m using packets.


    PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy();
    ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);

    Is there any possibility to define on which location a certain entity should be removed ? Thanks for your time
     
  2. Offline

    Legendary_zotar

    I dont understand what you mean by that

    But you can specify what entity you want to remove by using PacketPlayOutEntityDestroy(#NMSEntity.getId())

    Here is an example for an ArmorStand
    Code:
    ArmorStand ArmorStand = (ArmorStand) #World.spawnEntity(#Location, EntityType.ARMOR_STAND);
    EntityArmorStand Stand = ((CraftArmorStand)ArmorStand).getHandle();
    ((CraftPlayer)#Player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(Stand.getId()));
     
  3. Offline

    Machine Maker

    the PacketPlayOutEntityDestroy packet only accepts the entity UUID. so that is the only piece of information it can use to identify which entity to destroy.
     
Thread Status:
Not open for further replies.

Share This Page