How do disguises work?

Discussion in 'Plugin Development' started by Skionz, Oct 6, 2014.

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

    Skionz

    Alright so I am kind of interested in disguises such as creating an illusion that a player has turned into a mob. But right now I am wondering what the best way to do this would be? Currently I am thinking of hiding the player and whenever the player moves I would spawn client side mobs and remove the old ones however wouldn't this be quite server intensive?
     
  2. Offline

    ChipDev

    Uh.. im not sure.
    Go look at the code of some disguise plugins, Maybe it will give you an idea.
     
  3. Offline

    Totom3

    Skionz I'd just hide the player and spawn a mob with a certain metadata to identify it, then each time the player moves you move the mob. And also when the mob gets hit you cancel the event and apply the damage to the player. Would just need to find a way to change the vanilla attributes (followRange=0, walkingSpeed=0, etc...) of the mob.
     
  4. Offline

    Freelix2000

    I believe it uses craftbukkit's API to send packets and make it appear that an entity is there when it actually is not, and of course, hides the player.
    Totom3
    Your signature confuses me...
     
    Totom3 likes this.
  5. Offline

    Skionz

    Totom3 I'm trying find a way with client side ones but it looks really bad when I use the player move event and create and destroy the client side entity over and over
     
  6. Offline

    fireblast709

    Skionz instead of creating and destroying it, how about sending entity move & velocity packets?
     
    rbrick likes this.
  7. Offline

    FabeGabeMC

    Skionz Well, I used that method in my plugin couple of days ago... This is what happened:
    2014-09-30_22.54.53.png Just geez XD
    Edit: #CreeperExorcism? :p
     
  8. FabeGabeMC Stand near it in survival mode and the problem will definitely be solved, albeit explosively.
     
    FabeGabeMC likes this.
  9. Offline

    FabeGabeMC

  10. Offline

    RingOfStorms

    The simplest way to do this is to send the destroy packet for the player entity (hiding the player), and then send a creature spawn packet and set the entity id equal to the player's entity id. The server will do the rest.

    Edit: I do want to make clear that disguise API's are much better and will fix many of the client crashes that can occur with a lot of the disguises. I would just use an API, like LibsDisguises
     
  11. Offline

    Skionz

    RingOfStorms I will probably just use a lib thanks for the help.
     
  12. Offline

    FabeGabeMC

    RingOfStorms
    The server won't handle it as the entity won't move and it will be stationary...
    You also need to use PacketPlayOutRelEntityMove and rotate packets...
     
  13. Offline

    RingOfStorms

    The entity will move as the server is sending entity move packets with an entity ID of the player. If you spawn your custom mob with the same ID then the client will use the player's move packets for the custom entity. Trust me this is the easiest and cheapest way to do it.
     
  14. Offline

    FabeGabeMC

Thread Status:
Not open for further replies.

Share This Page