CitizensDev / Citizens2

Citizens - the premier plugin and API for creating server-side NPCs in Minecraft.
https://citizensnpcs.co
Open Software License 3.0
590 stars 313 forks source link

Can't play sleep animation #1135

Closed MatArtz closed 6 years ago

MatArtz commented 7 years ago

public static NPC spawnNPC(Location loc, String Skin, String Name) { NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.PLAYER, Name); npc.data().setPersistent(NPC.PLAYER_SKIN_UUID_METADATA, Skin); npc.data().setPersistent(NPC.PLAYER_SKIN_USE_LATEST, false); npc.spawn(loc);

return npc; }

NPC npc = spawnNPC(p.getLocation(), p.getName(), CubeLife.getRoleName(p, false, true)); PlayerAnimation.SLEEP.play((Player)npc.getEntity());

mcmonkey4eva commented 7 years ago

Sleep animation got weird in minecraft, it requires a bed in some specific position relative to the player entity to play correctly.

MatArtz commented 7 years ago

Could anyone help me to realize this or it's too difficult?

fullwall commented 7 years ago

The client actually checks that a bed is nearby these days. You have to put a bed nearby and be in night to get the animation to play.

ArctoranDev commented 7 years ago

Try this plugin: https://www.spigotmc.org/resources/nunpcdestinations-create-living-npcs-1-8-3-1-11.13863/

It comes with an addon animation plugin that allows you to set locations and have NPCs sleep at them, it's also got fishing, fishing and keeping the fish in inventory, opening chests and opening chests then emptying all the items into it.

mcmonkey4eva commented 4 years ago

I submitted a PR to fix this issue (and basically any other sleeping issues): https://github.com/CitizensDev/Citizens2/pull/2029