Removing Particles From Mobs

Discussion in 'Plugin Development' started by Jamesthatguy, Jul 25, 2013.

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

    Jamesthatguy

    Hello, I am hoping that someone can tell me how to remove the potion particles from a mob when I add an effect to the mob. I know how to do this with players but not sure how to with a zombie.
     
  2. Offline

    xTrollxDudex

    Jamesthatguy
    What I would do is use ProtocolLib to intercept the sending of Packets.Server.WORLD_EVENT and check if it is caused by a potion effect.
    Maybe Comphenix can help out a little here?
     
    Milkywayz likes this.
  3. Offline

    Comphenix

    You'll need to intercept Packet40EntityMetadata and set index 7 (potion color) to 0 (black).
     
  4. Offline

    Jamesthatguy

    How exactly do I access index 7? I know how to do every thing else but that line.
     
  5. Offline

    Comphenix

    Something like this should work:
    Code:java
    1. ProtocolLibrary.getProtocolManager().addPacketListener(
    2. new PacketAdapter(this, ConnectionSide.SERVER_SIDE, Packets.Server.ENTITY_METADATA) {
    3. public void onPacketSending(PacketEvent event) {
    4. PacketContainer packet = event.getPacket();
    5. Entity entity = packet.getEntityModifier(event.getPlayer().getWorld()).read(0);
    6.  
    7. if (entity instanceof Zombie) {
    8. for (WrappedWatchableObject obj : packet.getWatchableCollectionModifier().read(0)) {
    9. if (obj.getIndex() == 7) {
    10. // Disable the potion color
    11. obj.setValue((int) 0);
    12. }
    13. }
    14. }
    15. }
    16. }
    17. );
     
    Jamesthatguy likes this.
  6. Offline

    Jamesthatguy

    Thanks a ton!
     
    Comphenix likes this.
  7. Offline

    Tomass

    I'm very sorry for uplift old theard, but I haven't any way to find the answer for my problem. I try to use Comphenix code (added the ProtocolLib). That's what I have:
    [​IMG]
    Error is:
    [​IMG]
     
  8. Offline

    Comphenix

    Pass in a reference to your plugin instead of "this" in line 118.
     
    Tomass likes this.
Thread Status:
Not open for further replies.

Share This Page