pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.28k stars 1.56k forks source link

Entity head yaw & rethink of `Location` #6503

Open dktapps opened 1 week ago

dktapps commented 1 week ago

Description

This has been a thing at the network level for a long time, but never supported in the core code.

As seen in #4819 this raised some interesting issues around Location, since not all entities have a head, and therefore head yaw.

However, many entities also don't need basic yaw/pitch either (projectiles, dropped items, XP orbs, paintings), so it raises the question of whether Location should be rethought, considering that adding headYaw will probably break BC anyway.

My current thought is that Location should probably be deleted altogether, or renamed. It's only really suited to Living inheritors, and many non-living entities either don't need rotation info (round projectiles, items, XP orbs), or use an entirely different mechanism for rotation (like paintings). Even the likes of arrows don't follow the expected rules for yaw/pitch despite using them.

Possibly these instead:

I leave this as an exercise for future developers.

dktapps commented 1 week ago

As for teleport(), perhaps it should work like this:

These overloads should work fine if the proper hierarchies are used.