Help with PacketPlayOutEntityMetadata

Discussion in 'Plugin Development' started by TheDummy, Jan 26, 2014.

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

    TheDummy

    I would like to know if it is possible to edit a player entity's name using this method. I've tried messing with it and I don't get any errors when running, but the name does not change.

    I came across the BasicHuman library and it implemented a "change name" function. The source was on GitHub and I copied and pasted the code (resolving import, class, and field name issues). When running and compiling there were no errors, but the name did not change.

    Code:java
    1. DataWatcher d = new DataWatcher( null );
    2. d.a(0, (Object) (byte) 0);
    3. d.a(1, (Object) (short) 0);
    4. d.a(8, (Object) (byte) 0);
    5. // String passed into the rename function
    6. d.a(10 , (Object) (String) newName);
    7. // 11 is "always show nameplate" according to the Protocol website
    8. d.a(11, (Object) (byte) 0);


    That is the information put into the data watcher before the packet is broadcast to all players on the server. Is there another way to rename the entity or a problem with this one?

    Bonus question: Why is it required to add 0, 1, and 8 into the datawatcher? (The source I saw had it in all functions.) What are these indexes based on?

    Thanks for any help.

    Does anyone know if the name aspect of the packet is specific to non-player living entities? (Mobs)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  2. Offline

    TheDummy

    This is a bump as I still have not found a solution.
     
  3. Offline

    Creepapa

  4. Offline

    TheDummy

    Thanks, but that's what my code is based off of. I edited the '10' property in hopes of changing the entity's name (entity was spawned using PacketPlayOutNamedEntity), but to no avail.
     
Thread Status:
Not open for further replies.

Share This Page