juliarn / npc-lib

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

Yaw not correct on spawn #47

Closed justlunix closed 10 months ago

justlunix commented 3 years ago

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.

derklaro commented 3 years ago

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

juliarn commented 3 years ago

Yeah we could do that

DxsSucuk commented 1 year ago

Still present in 1.8

arnhav commented 1 year ago

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

derklaro commented 1 year ago

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.

DasBabyPixel commented 1 year ago

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

arnhav commented 1 year ago

Gotcha, thanks!

derklaro commented 10 months ago

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