juliarn / npc-lib

Asynchronous, high-performance Minecraft NPC library for 1.8-1.21 servers.
MIT License
296 stars 50 forks source link

Change NPC name #73

Closed aematsubara closed 1 year ago

aematsubara commented 2 years ago

Hi! Basically, I'm trying to change the name of a NPC, like this:

String villagerName = PluginUtils.getCustomData(container, EntityReplacer.NAME_KEY, String.class); npc.getProfile().setName(villagerName + " (Following)"); npc.visibility().queuePlayerListChange(VisibilityModifier.PlayerInfoAction.UPDATE_DISPLAY_NAME).send();

But nothing happens (no error in console), the name is the same as before, am I doing something wrong?

Also, I would like to change the texture of the NPC (setting its texture value and signature) without having to create a new NPC, how would I do that?

Thanks :)

derklaro commented 2 years ago

What you're trying there is not possible as the profile name/uuid/properties are copied once initially when the npc is created, changes to the profile returned from getProfile will therefore not reflect into outbound packets.

derklaro commented 1 year ago

Closing due to inactivity.