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

Yaw not correct on spawn

Open justlunix opened this issue 4 years ago • 2 comments

When setting the yaw of an npc while creating it using NPC.builder().location(loc), the yaw is not correct.

Updating it via npc.rotation.queueRotation(yaw, pitch) works just fine.

justlunix avatar Aug 30 '21 20:08 justlunix

That is an old client bug... @juliarn should we fix this internally by sending a head rotation after the spawn?

derklaro avatar Sep 06 '21 07:09 derklaro

Yeah we could do that

juliarn avatar Sep 06 '21 08:09 juliarn

Still present in 1.8

DxsSucuk avatar Jan 06 '23 12:01 DxsSucuk

I believe this issue is still present, how do we fix this with the 3.0 releases?

arnhav avatar Aug 29 '23 19:08 arnhav

v3 uses a different approach to this problem by sending the information again when the player moves inside the imitation distance of a npc and the LOOK_AT_PLAYER flag is set (and, of course, the action controller is enabled). This check also includes rotation of the player and is not limited to moving into any direction. If you want the npc to instantly look at the player after spawning you can do that with your own spawn listener. @DasBabyPixel recently implemented such a change (or, at least, we were discussing about it) so maybe he can give some input on this topic as well.

derklaro avatar Aug 30 '23 07:08 derklaro

Yes the change to sync the yaw and pitch on spawn has already been implemented. It just isn't in the beta5, so you have to depend on the latest commit instead of beta5.

implementation("com.github.juliarn.NPC-Lib:npc-lib-bukkit:8eb7fbe")

If you have the field NpcActionController.AUTO_SYNC_POSITION_ON_SPAWN then everything should work

DasBabyPixel avatar Aug 30 '23 13:08 DasBabyPixel

Gotcha, thanks!

arnhav avatar Aug 30 '23 17:08 arnhav

beta6 was released with these changes, closing this as complete. Feel free to open a new issue if the issue is still there

derklaro avatar Oct 27 '23 09:10 derklaro