How to disable zombie sound?

Discussion in 'Plugin Development' started by Tomass, Nov 27, 2014.

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


    Hello guys,

    today I tried to disable zombie (saying) sound and I had found way to do it with ProtocolLib, but it seems doesn't work, I haven't got any ideas why... Please do not shouting: "Search in google! and e.t.c.. " I already have searched and found only two threads: but normal answer was only one...

    I tried this way, which is recommended by the Comphenix but it seems not to working...

    This is my code:
    1. public void onEnable(){
    2. getServer().getPluginManager().registerEvents(this, this);
    3. getLogger().info("enabled!");
    5. final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    6. manager.addPacketListener(
    7. new PacketAdapter(this, ConnectionSide.SERVER_SIDE,
    8. Packet3ENamedSoundEffect.ID) {
    9. @Override
    10. public void onPacketSending(PacketEvent event) {
    11. Packet3ENamedSoundEffect named = new Packet3ENamedSoundEffect(event.getPacket());
    13. // Just rename all zombie sounds to skeleton sounds
    14. named.setSoundName(named.getSoundName().replace("mob.zombie", "mob.skeleton"));
    15. }
    16. });
    17. }

    This is result: (cannot find packet)

    I will very happy if someone helps me :)

    P.S Sorry for bad my english...
  2. Offline


    Tomass The packets got renamed in 1.7 I believe. You would probably use this 'PacketPlayOutNamedSoundEffect'
  3. Offline


    I think you need to change "Packet3ENamedSoundEffect.ID" to "PacketType.Play.Server.Named_Sound_Effect".
    Then you can check the packet event and do what you need to do.

    I'm totally guessing with this answer however, it is a logical guess after seeing the ProtocolLib JavaDoc

    Edit: You could just look at the examples given at their GitHub...
  4. Offline


    Tomass If you are looking for more than just disabling zombie noises, you could always use NMS to override the EntityZombie class, and change the method to return what sound it plays! But if not, and you just want this, do as the two above have said.
  5. Offline


  6. Offline


    Should I copy all this class and input it in my plugin, or I can do it wihout creating new classes, just use it from ProtocolLib Build Patch? Because now, after changes I see this:
  7. Offline


    Tomass Is it imported? What is your error?
  8. Offline


    Yes it is imported. Error:
    And this pack WrapperPlayServerNamedSoundEffect are too not availabe...
  9. Offline


    Tomass Is protocollib in your build path?
  10. Offline


    Yes, of course. I'm using latest ProtocolLib dev build (3.6.0).
  11. Offline


    Ah, sorry, should have mentioned this earlier. You need to copy this class and AbstractPacket into your plugin.
  12. Offline


    Thank you very much Comphenix ! You have really nice and helpful supplement!
    Comphenix likes this.
Thread Status:
Not open for further replies.

Share This Page