npc-lib icon indicating copy to clipboard operation
npc-lib copied to clipboard

Change NPC name

Open aematsubara opened this issue 3 years ago • 1 comments

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 :)

aematsubara avatar May 26 '22 17:05 aematsubara

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 avatar May 27 '22 09:05 derklaro

Closing due to inactivity.

derklaro avatar Dec 31 '22 21:12 derklaro