#(itzmxritz) Creating NPCs with api, sometimes they have no skin

8 messages · Page 1 of 1 (latest)

solemn frigate
#

Hey there. im using the citizens api to create an npc via command in my own plugin.

NPC citizen = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, name);
citizen.spawn(location);

SkinTrait skinTrait = citizen.getOrAddTrait(SkinTrait.class);
skinTrait.setSkinPersistent(creator.toString(), skinSignature, skinValue);

citizen.getEntity().setCustomNameVisible(true);
citizen.getEntity().customName(MiniMessage.miniMessage().deserialize(name));

Chunk chunk = citizen.getEntity().getLocation().getChunk();
chunk.load();```

The skin trait sets the skin to the signature and value of the creators skin, so my own. But as you can see in the screen, sometimes theres no skin set and sometimes it works with the same code and the same skin data
split crestBOT
#

(itzmxritz) Creating NPCs with api, sometimes they have no skin

split crestBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

fallow edge
#

You should move the skin trait call above the spawn call

#

And you should use the nameplate visible metadata not customnamevisible

woeful jackalBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@solemn frigate