Disable certain mob noise? (Packet Handling?)

Discussion in 'Plugin Development' started by valon750, Dec 26, 2013.

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

    valon750

    As the title states, I'm looking to essentially "mute" certain mobs, so I can set them invisible without having to worry about them making noise.

    I assume this will require me to look in to messing around with Packets, but as I've personally never done such a thing, I'd be ever so grateful if you could push me in the right direction, or possibly help out by giving me some snippets to chew on.
     
  2. Offline

    mrkirby153

  3. Offline

    valon750

    mrkirby153
    I'd gladly use that, and I have had a slight look in to it, but I haven't got the first clue about how I could go about doing that
     
  4. Offline

    Jogy34

    If you really wanted to (so that you wouldn't have to mess with packets) you could create your own custom entity and then have all of its sound methods return an empty string.
     
  5. Offline

    valon750

    Jogy34

    Now that definitely sounds promising! Would I be able to get an example of that?
     
  6. Offline

    Ronbo

    valon750
    Follow the creating custom mobs tutorial in the Resources section, and override t(), aT(), and aU() to return empty strings.
     
  7. Offline

    Jogy34

    That's fairly out of date the last time I checked it.

    I helped someone through a similar thing a little bit ago on this thread. That goes into detail mostly on NPC player entities but the basic ideas are pretty much the same. I will also point you to a few examples of different custom entities from my own code here. And the Bukkit git-hub page is also useful for doing things like this, you would want to look through the Craftbukkit repo and the mc-dev repo (which is currently out of date but still retains a lot of usefulness).

    It looks like to get rid of the sounds that you would want to override, like Ronbo said, the aT() and aU() methods (I'm not sure about the t() method as I can't find it) but also probably the o(int i), O(), and H() methods to all return empty Strings. aU(), aT(), and o(int i) are all from EntityLiving where O() and H() are all from Entity. You should also probably look through whatever entity you are extending off of to make sure that there are no other methods that return a sound.
     
  8. Offline

    Ronbo

    Jogy34
    The method itself still works, just needs some reflection now since the biome stuff became private in 1.7 T_T
    Also, t() is only for zombies and skeletons, as they have an extra "say" sound (ex: the groan that zombies make)
     
Thread Status:
Not open for further replies.

Share This Page