Solved Lightning Weather Packet

Discussion in 'Plugin Development' started by Rexe0, Jun 27, 2020.

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

    Rexe0

    The 1.16 update has recently been released and with it lots of things have been added. However, when I updated my plugin to the new file the packet, "PacketPlayOutSpawnEntityWeather" was removed. I used this packet to summon lightning without creating any fire or damage as well as sending it to one player.

    Is there any other packet that does this?
    If so what are its parameters and its name.



    Annotation 2020-06-28 120552.png
     
  2. Offline

    Legendary_zotar

    Im new to packets, but would the Spawn Entity packet work? (maybe they changed it to that?)
    [​IMG]
     
  3. Offline

    Rexe0

    I'll try that.





    Ok, It worked. Thank you.
    For those wondering, this is what I used. Correct me if I did something wrong or could do something better.


    Code:
    EntityLightning lightning = new EntityLightning(EntityTypes.LIGHTNING_BOLT, ((CraftWorld)e.getEntity().getWorld()).getHandle());
    
    Vec3D vec = new Vec3D(0, 0, 0);
    
    PacketPlayOutSpawnEntity lightningPacket = new PacketPlayOutSpawnEntity(lightning.getId(), lightning.getUniqueID(), e.getEntity().getLocation().getX(), e.getEntity().getLocation().getY(), e.getEntity().getLocation().getZ(), 0f, 0f, EntityTypes.LIGHTNING_BOLT, 0, vec);
    
    
    ((CraftPlayer) ((Player) damager)).getHandle().playerConnection.sendPacket(lightningPacket);
     
    Last edited: Jun 28, 2020
    Legendary_zotar likes this.
Thread Status:
Not open for further replies.

Share This Page