Disable Lightning Noise

Discussion in 'Plugin Development' started by Evonoucono, Jul 23, 2015.

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

    Evonoucono

    I made a plugin that summons lightning whenever a player right clicks a custom item I made, and I was wondering if there was a way to disable the thunder noise that comes with the lightning. I do not want all players on the server to hear the thunder whenever someone summons lightning because that's just annoying having to hear a bunch of loud noises from far away that don't even begin to concern you. Does anyone have any ideas, it would be much appreciated!
     
  2. Offline

    WinX64

    Apparently, the lightning sound is sent by the server while ticking the entity. I tried sending the lightning manually and it working without sounds, with some nms though.

    Code:
    Location loc = <generic location>;
    EntityLightning lightning = new EntityLightning(((CraftWorld) loc.getWorld()).getHandle(), loc.getX(), loc.getY(), loc.getZ());
    MinecraftServer.getServer().getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new PacketPlayOutSpawnEntityWeather(entity);
    This will send the packet to everyone in a squared distance of 512 blocks. If you want to only send the lightning to the player, send it the packet directly. Both means won't produce any sound.

    I'm not sure if this is the only way, but the only one i could come up with.
     
  3. Offline

    Evonoucono

    What do you mean by <generic location>, I get an error with this saying, "syntax error, type annotations are illegal here." Does it matter what public void this is under?
     
  4. Offline

    WinX64

    Means that it can be any location, player's location, where it is looking at, etc. Sorry for not specifing it.
     
  5. Offline

    Konato_K

    @Evonoucono Have you tried using ProtocolLib and intercept the outgoing packet?
     
  6. Offline

    Evonoucono

    Yes, however it seems very complicated :p
     
Thread Status:
Not open for further replies.

Share This Page